Getting Data from Forms
Posted: Thu Dec 11, 2003 1:22 pm
Hello,
First, I just want you to know I'm a PHP newbie. I know Java so the classes make all kinds of sense, but I'm trying to do some very simple things right now.
What I like'd to do is take a form that involves checkboxes and get data from that to make queries into MySQL (specifically, delete rows based on the data from the form).
So, I was doing this last night and was failing, but that's to be expected as it was late.
The data that fills the form is from a MySQL query that I think is right. Here is what the form looks like when viewing the source:
<input type=checkbox name="Test">Test</input>
I know it does output something (I tried it with a formmail script) and it sends something like:
Test: On
My form action and submit button looks like:
<form action="deletelinks.php" method="post">
<input type=submit name=deletelinks value="Delete">
And my problems come with the "deletelinks.php" file. What should be in this to get the form data into PHP variables.
Right now the "deletelinks.php" page is basically blank. But I was trying stuff like:
$formsubmittedata = $_REQUEST['name'];
I'm sorry if this is very elementary, I've done very little work with PHP, but so far I really like it.
If you're wondering, this is my entire deletelinks.php file (print call was for testing purposes):
<?
$formVariableName = $_REQUEST['name'];
$recipient = $formVariableName;
print($recipient);
?>
Thank you very much for any help in advance,
Eric
First, I just want you to know I'm a PHP newbie. I know Java so the classes make all kinds of sense, but I'm trying to do some very simple things right now.
What I like'd to do is take a form that involves checkboxes and get data from that to make queries into MySQL (specifically, delete rows based on the data from the form).
So, I was doing this last night and was failing, but that's to be expected as it was late.
The data that fills the form is from a MySQL query that I think is right. Here is what the form looks like when viewing the source:
<input type=checkbox name="Test">Test</input>
I know it does output something (I tried it with a formmail script) and it sends something like:
Test: On
My form action and submit button looks like:
<form action="deletelinks.php" method="post">
<input type=submit name=deletelinks value="Delete">
And my problems come with the "deletelinks.php" file. What should be in this to get the form data into PHP variables.
Right now the "deletelinks.php" page is basically blank. But I was trying stuff like:
$formsubmittedata = $_REQUEST['name'];
I'm sorry if this is very elementary, I've done very little work with PHP, but so far I really like it.
If you're wondering, this is my entire deletelinks.php file (print call was for testing purposes):
<?
$formVariableName = $_REQUEST['name'];
$recipient = $formVariableName;
print($recipient);
?>
Thank you very much for any help in advance,
Eric