Page 1 of 1

Problems inserting data into mysql

Posted: Sun Mar 15, 2009 4:36 pm
by bradlays
http://pastebin.com/m5f0ef9f3 - Script can be found on this link.

I am trying to make my script go to a preview page of the users inputted data before actually submitting the code into the database. When they press the submit button it is supposed to insert that data and present them with a brief message letting them know that everything was inserted. Instead of it doing that though, when the submit button is pressed all it does is "restart" the script, and when I check the scripts table, nothing no data has been inserted. Can anyone explain to me why it is doing this?

Re: Problems inserting data into mysql

Posted: Sun Mar 15, 2009 9:39 pm
by bradlays
guess i have to go to a more advanced forum, thanks anyways.

Re: Problems inserting data into mysql

Posted: Mon Mar 16, 2009 12:13 am
by susrisha
have gone through your code and here are the few things i failed to find:
1. In the form where is the submit button other than preview?

Code: Select all

 
<input type="submit" name="preview" value="Preview" />
<input type="submit" name="submit" value="submit" /> //this is not present
 
2. Where are you assigning posted values of the input fields?

Code: Select all

 
$sname = $_POST['sname'];//similiar lines..
 

Re: Problems inserting data into mysql

Posted: Mon Mar 16, 2009 12:39 am
by jlising
You can use sessions for you to store the data posted in temporary locations.