hi all,
I am getting lost in showing data entered in a form to a confirm page.
I have a form with as many list/menu as the categories existing in the
database. DONE
when user choose the items from the list/menus they are passed on to a
second page where he can check if all data are correct and then send
it. DONE
However on the confirm page the script returns also empty lines of text
for the missing fields. I would like to just have the fields entered by
the user one after each other and not as they were on the first form.
How can I get rid of the empty fields ? ( of course just removing the
<BR> tag is not a solution )
I post the code of both pages below ( only the part of interest )
TIA
Johnny
CONFIRM PAGE
<form name="form1" method="post" action="send.ph p">
<p>Please check the data u entered</p>
<p>
<input name="hiddenFie ld" type="hidden" value="<?php
foreach ($_POST['field'] as $name=>$value) {
echo nl2br("$value") ;
}
?>">
<?php
foreach ($_POST['field'] as $name=>$value) {
$split = split("\=", $value);
$pieces = explode("=", $value);
echo nl2br("$pieces[1]<BR>");
}
?>
</p>
<input name="Submit" type="submit" value="PROCEDI >>">
</p>
</form>
FORM PAGE
<form name="form1" method="post" action="confirm .php">
<?php
$cat=mysql_quer y("SELECT DISTINCT category FROM table ORDER BY
id", $db);
while ($category=mysq l_fetch_array($ cat)) {
$array_categoy[]=$category["category"];
}
foreach($array_ category as $key=>$val) {
$data_link=mysq l_query("SELECT * FROM table WHERE
category='$val' ",$db);
?>
<?php $label = str_replace ( "_"," ",$val) ; ?>
<p> <?php echo $label; ?></p>
<select name="field[<?php $val ?>]"id="<?php $val ?>">
<option > - - - - - - - - - - - - </option>
<?php
while ($link=mysql_fe tch_array($data _link)) {
$description_li nk= $link["product"];
$id_link = $link["id"];
$code_link = $link["code"];
print "<option value=\"$code_l ink = $description_li nk\">
$description_li nk </option>";
}
?>
</select>
<?php
}
?>
<input name="Submit" type="submit" value="GO ON >>">
</form>
I am getting lost in showing data entered in a form to a confirm page.
I have a form with as many list/menu as the categories existing in the
database. DONE
when user choose the items from the list/menus they are passed on to a
second page where he can check if all data are correct and then send
it. DONE
However on the confirm page the script returns also empty lines of text
for the missing fields. I would like to just have the fields entered by
the user one after each other and not as they were on the first form.
How can I get rid of the empty fields ? ( of course just removing the
<BR> tag is not a solution )
I post the code of both pages below ( only the part of interest )
TIA
Johnny
CONFIRM PAGE
<form name="form1" method="post" action="send.ph p">
<p>Please check the data u entered</p>
<p>
<input name="hiddenFie ld" type="hidden" value="<?php
foreach ($_POST['field'] as $name=>$value) {
echo nl2br("$value") ;
}
?>">
<?php
foreach ($_POST['field'] as $name=>$value) {
$split = split("\=", $value);
$pieces = explode("=", $value);
echo nl2br("$pieces[1]<BR>");
}
?>
</p>
<input name="Submit" type="submit" value="PROCEDI >>">
</p>
</form>
FORM PAGE
<form name="form1" method="post" action="confirm .php">
<?php
$cat=mysql_quer y("SELECT DISTINCT category FROM table ORDER BY
id", $db);
while ($category=mysq l_fetch_array($ cat)) {
$array_categoy[]=$category["category"];
}
foreach($array_ category as $key=>$val) {
$data_link=mysq l_query("SELECT * FROM table WHERE
category='$val' ",$db);
?>
<?php $label = str_replace ( "_"," ",$val) ; ?>
<p> <?php echo $label; ?></p>
<select name="field[<?php $val ?>]"id="<?php $val ?>">
<option > - - - - - - - - - - - - </option>
<?php
while ($link=mysql_fe tch_array($data _link)) {
$description_li nk= $link["product"];
$id_link = $link["id"];
$code_link = $link["code"];
print "<option value=\"$code_l ink = $description_li nk\">
$description_li nk </option>";
}
?>
</select>
<?php
}
?>
<input name="Submit" type="submit" value="GO ON >>">
</form>
Comment