Forum Moderators: coopster
Then I would like all the responses to be posted on the same page, just below the submit form.
I can run PHP and I have a mysql database.
I think I use something like method=post action=somephpscript.php
but I don't know what script to use, and I don't know how to get the info to print back onto the html page.
Can anyone help out?
Thanks!
Emily.
You will probably want to write your own script in this case, and you came to the right place ;)
There are a number of ways to accomplish what you want to do and I'll show you some basics here and follow-up with some recommended reading. I think a working example will be best. Cut and paste the following code into a text editor, save the file with a .php extension and FTP the script to your server. Then just open the script in your web browser to test it:
form_sample.php
<html><head><title>Sample</title></head><body>
<form action="<?php print [php.net] $_SERVER [php.net]['PHP_SELF'];?>" method="post">
Name: <input type="text" name="name" /><br /><br />
Title: <input type="text" name="title" /><br /><br />
Response: <input type="text" name="response" size="50"
value="Check\Whacks and apostrophe's" /><br /><br />
<input type="submit" name="Submit" value="Submit" />
</form>
<?php
if ($_POST['Submit']) {
$name = $_REQUEST['name'];
$title = $_REQUEST['title'];
$response = $_REQUEST['response'];
print '$name is ' . $name . '<br />';
print '$title is ' . $title . '<br />';
print '$response is ' . $response . '<br />';
print 'stripslashes($name) is ' . stripslashes [php.net]($name) . '<br />';
print 'stripslashes($title) is ' . stripslashes($title) . '<br />';
print 'stripslashes($response) is ' . stripslashes($response) . '<br />';
}
?>
</body></html>