...

View Full Version : Help - Code is redefined so where did I go wrong?



ghost2012
10-29-2009, 07:59 AM
What I'm trying to do is receive only data input.
So where did I go wrong.

This is the html code.



<form action="order001.php" method="post" style="height: 460px">
order01<input id="order01" style="width: 40px" type="text" /> <br />
order02<input id="order02" style="width: 40px" type="text" /><br />
order03<input id="order03" style="width: 40px" type="text" /><br />
<br />
<input name="Submit1" type="submit" value="submit" />
</form>



This is the php code.



<?php
$order01 = $_POST["order01"];
$order02 = $_POST["order02"];
$order03 = $_POST["order03"];

if ( $order01 > 0 ) {
echo " amount of $order01 <br />";
}else {
break;
}

if ( $order02 > 0 ) {
echo " amount of $order01 <br />";
}else {
break;
}
if ( $order03 > 0 ) {
echo " amount of $order01 <br />";
}else {
break;
}


?>



I'm not trying to use any array just yet but if you know how I'm willing to learn. :D
Any comments or critique is welcomed.

Phil Jackson
10-29-2009, 08:26 AM
What do you mean by data input? all input is data, no?

Phil Jackson
10-29-2009, 08:33 AM
<?php
if(isset($_POST['Submit1']))
{
if ( isset($_POST["order01"]) && !empty($_POST["order01"]) )
echo " amount of ".$_POST["order01"]." <br />";
else
die("insert order 01");


if ( isset($_POST["order02"]) && !empty($_POST["order02"]) )
echo " amount of ".$_POST["order02"]." <br />";
else
die("insert order 02");

if ( isset($_POST["order03"]) && !empty($_POST["order03"]) )
echo " amount of ".$_POST["order03"]." <br />";
else
die("insert order 03");
}
?>

Phil Jackson
10-29-2009, 08:34 AM
break; is mainly used for stopping a loop



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum