![]() |
PHP Question.. clearing variables...
say for example you're submitting a form to the page it is on (php_self).. and say you hit the refresh button after submitting that form... all those variables are re-submitted which causes for duplication... how do you avoid that so that you can clear those variables out?
i thought unset($variable) would work, but it doesn't. the code looks like: if (isset($comment)) { $date = time(); $sqlquery6 = "INSERT INTO bgcomments VALUES ('id','$_SESSION[username]','$uid','$comment','$date')"; $resultse = mysql_query($sqlquery6); unset($comment); } |
if (isset($_POST['comment']))
{ $date = time(); $r = mysql_query("INSERT INTO bgcomments VALUES ('id','$_SESSION[username]','$uid','$comment','$date')"); unset($comment); } |
I don't quite understand what you're doing. What I would do, however, is work on the syntax a bit more.
maybe even add if($_SERVER['REQUEST_METHOD'] hahahaha post) { // code inside } that tells the script to only parse if the type is POST, meaning from a form of some sort :) hope that helps CHEERS |
All times are GMT -7. The time now is 04:08 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123