where then I could call likePHP Code:<?$i = 0
$num= 10
while ($i < $num) {?>
<input type="submit" name="<?$i?>order1" value="Order This">
<?$i++?> }
???PHP Code:if ($iorder1){}
Printable View
where then I could call likePHP Code:<?$i = 0
$num= 10
while ($i < $num) {?>
<input type="submit" name="<?$i?>order1" value="Order This">
<?$i++?> }
???PHP Code:if ($iorder1){}
name="<?echo $i?>order1"
ok got how to change name name's now need to learn how to call to it...
and P.S. I NEED to get firefox, way better!
you could use hidden fields
thenPHP Code:<?$i = 0
$num= 10
while ($i < $num) {?>
<input type="hidden" name="function" value="<?php echo $i; ?>order1"/>
<input type="submit" name="<?$i?>order1" value="Order This" />
<?$i++?> }
PHP Code:if($_POST['function']=="1order1")
{
//function code
}
//.... etc
Give your submit buttons all the same name and each a unique value (which is its caption). When the form is posted you can tell which submit button was pressed just like any other input field.
PHP Code:<div>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<p>Which do you prefer?</p>
<p><input type="submit" name="fsubmit" value="Puppies"></p>
<p><input type="submit" name="fsubmit" value="Kittens"></p>
</form>
</div>
If you're using XHTML remember to close the input tags with a />.PHP Code:switch ($_POST['fsbumit']) {
case 'Puppies':
# ...
break;
case 'Kittens':
# ...
break;
}