PDA

Click to See Complete Forum and Search --> : Easy Form Question


lintz
Sep 6th, 2004, 06:34 AM
There will be such an easy answer for this but if I have a form which asks the user to delete an entry or not, how do I pass Yes/No into the form string?


echo "<form name =\"form1\" method=\"post\" action=\"forums.php?delete_entry=(how to add yes/no here)\">

Do you want to delete this entry?<br>
<input type=\"submit\" value=\"Yes\">
&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" value=\"No\">
</form>";

mendhak
Sep 6th, 2004, 07:16 AM
Change the method to "get", and it'll be appended to the querystring automatically.

Btw, your <input type="submit">s need a name.




echo "<form name =\"form1\" method=\"get\" action=\"forums.php\">

Do you want to delete this entry?<br>
<input type=\"submit\" value=\"Yes\">
&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" value=\"No\">
</form>";

visualAd
Sep 6th, 2004, 11:13 AM
Originally posted by lintz
There will be such an easy answer for this but if I have a form which asks the user to delete an entry or not, how do I pass Yes/No into the form string?


echo "<form name =\"form1\" method=\"post\" action=\"forums.php?delete_entry=(how to add yes/no here)\">

Do you want to delete this entry?<br>
<input type=\"submit\" value=\"Yes\">
&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" value=\"No\">
</form>";

Firstly if you have a whole chunk of HTML its alot easier to take it outside PHP tages. Secondly for this to work you need to give your submit buttons the name "delete_entry":

?>
<form name ="form1" method="GET" action="forums.php">
Do you want to delete this entry?<br />
<input type="submit" name="delete_entry" value="Yes">
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="delete_entry" value="No">
</form>
<?php
...
...


EDIT: Just do exactly what Mendhak said :rolleyes:

mendhak
Sep 8th, 2004, 01:32 AM
:lol: