php-general | 2001122
Date: 12/22/01
- Next message: Steven Cayford: "Re: [PHP] Ensuring that Form is only submitted once (session vars?)"
- Previous message: Yasuo Ohgaki: "[PHP] Re: Limit script memory usage !!"
- Next in thread: Warren Vail: "RE: [PHP] "Talkback" or community type participation....."
- Reply: Warren Vail: "RE: [PHP] "Talkback" or community type participation....."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi there!
I have this script I just made based on a tutorial I found online and was
wondering if there was a better way to do this or not. Everything works
great so far except for a couple little things. Once the $submit is clicked
and runs the INSERT data into the table... I am looking to be able to have
the page auto refresh and display the new entry as well as the form again.
Here's my current code: (I have this built into the main review page via an
include. The entire page can be viewed here:
http://www.metalages.com/2002/reviews/reviews-test.php?band=Evergrey&album=I
n%20Search%20of%20Truth
Feel free to post a dummy message, nothing is live yet, all in test mode :)
you'll notice once the entry is submitted also, if you try to refresh the
page it wants to readd the data again. any help or guidance appreciated, I
am a self professed "still learning this stuff"! kinda guy.
<?php
if ($submit) {
// Process Form
$DBconn = mysql_connect("localhost", "user", "pass");
mysql_select_db("databasename", $DBconn);
if (!$DBconn) {
echo( "<p>Unable to connect to the " .
"database server at this time.</p>" );
exit();
}
$sql = "INSERT INTO talkback (band_id, album_id,
talkback_name,talkback_email,talkback_comments) VALUES
('$currentid[0]','$currentid[1]','$talkback_name','$talkback_email','$talkba
ck_comments')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
} else {
// display form
?>
<form method="post" action="<?php echo "$PHP_SELF" . "?band=$band" .
"&album=$album"?>">
<div align="center"><b>Name/Nickname:</b><br>
<input type="Text" name="talkback_name"><br>
<b>Email (optional):</b><br>
<input type="Text" name="talkback_email"><br>
<b>Comments:</b><br>
<textarea name="talkback_comments" cols="50" rows="5"></textarea>
<br>
<input type="Submit" name="submit" value="Speak Your Metal!">
</div>
</form>
<?php
} // end if
?>
Deron
www.metalages.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Steven Cayford: "Re: [PHP] Ensuring that Form is only submitted once (session vars?)"
- Previous message: Yasuo Ohgaki: "[PHP] Re: Limit script memory usage !!"
- Next in thread: Warren Vail: "RE: [PHP] "Talkback" or community type participation....."
- Reply: Warren Vail: "RE: [PHP] "Talkback" or community type participation....."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

