PHP: Help!

This is a discussion on "PHP: Help!" within the PHP Forum section. This forum, and the thread "PHP: Help! are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 24th, 2003, 12:32
New Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
PHP: Help!

Hello,

I've got a form with two input boxes both with variables say $a and $b, when i submit the form i think there cached in the browers navigation bar. So when i hit refresh on the submit page it keeps adding to the MySql database. Is there a way to prevent this using the Location command?

  #2 (permalink)  
Old Aug 24th, 2003, 12:49
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
Have talked to you via chat, but here is the same answer.

I've never heard of the location command, but you could include a hiddne field with an ID in the form. Then it doesn't matter how many times the user submits, there will only be one entry in the database.
  #3 (permalink)  
Old Aug 27th, 2003, 21:15
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
Yeah, or use POST in your form instead of GET so the variables aren't cached in the URL.
  #4 (permalink)  
Old Aug 31st, 2003, 21:29
New Member
Join Date: Aug 2003
Location: USA
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Is the user logged on? Are you storing the user_ID with the answer Or as suggested, a hidden ID will work (created randomly per session?). Put a unique constraint on the table where the data is stored. If an 'insert' command encounters no problems, it returns error number 0. If it encounters a unique key constraint violation, it returns 1062.

You can do something like:
$result = mysql_db_query("database_Name",$strSQL);
if (mysql_errno() == 1062) {
echo "[img]images/warn.gif[/img]";
echo " [b]You already submitted this information!B>
";
}
Closed Thread

Tags
php, help

« - | HTTP_POST_VARS... »
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 21:44.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43