|
-
Sep 6th, 2004, 06:34 AM
#1
Thread Starter
PowerPoster
Easy Form Question
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?
PHP Code:
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\">
<input type=\"submit\" value=\"No\">
</form>";
Last edited by lintz; Sep 22nd, 2004 at 10:09 PM.
-
Sep 6th, 2004, 07:16 AM
#2
Change the method to "get", and it'll be appended to the querystring automatically.
Btw, your <input type="submit">s need a name.
PHP Code:
echo "<form name =\"form1\" method=\"get\" action=\"forums.php\">
Do you want to delete this entry?<br>
<input type=\"submit\" value=\"Yes\">
<input type=\"submit\" value=\"No\">
</form>";
-
Sep 6th, 2004, 11:13 AM
#3
Re: Easy Form Question
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?
PHP Code:
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\">
<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":
PHP Code:
?>
<form name ="form1" method="GET" action="forums.php">
Do you want to delete this entry?<br />
<input type="submit" name="delete_entry" value="Yes">
<input type="submit" name="delete_entry" value="No">
</form>
<?php
...
...
EDIT: Just do exactly what Mendhak said
-
Sep 8th, 2004, 01:32 AM
#4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|