Problems inserting data into mysql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bradlays
Forum Newbie
Posts: 2
Joined: Sun Mar 15, 2009 4:30 pm

Problems inserting data into mysql

Post 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?
bradlays
Forum Newbie
Posts: 2
Joined: Sun Mar 15, 2009 4:30 pm

Re: Problems inserting data into mysql

Post by bradlays »

guess i have to go to a more advanced forum, thanks anyways.
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: Problems inserting data into mysql

Post 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..
 
User avatar
jlising
Forum Commoner
Posts: 33
Joined: Mon Mar 19, 2007 1:48 am
Location: Pampanga, Philippines
Contact:

Re: Problems inserting data into mysql

Post by jlising »

You can use sessions for you to store the data posted in temporary locations.
Post Reply