|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
HTML form preview then INSERT using PHP & MySQL
Hello everyone! This is regarding HTML forms, PHP & MySQL.
My Question: How do you create an html form that goes to a preview screen and then allows the user to move back to the form if they made any errors and corrections are needed or click the send button to submit the form. The form's contents are then inserted into a database table. |
|
#2
|
|||
|
|||
|
RE: HTML form preview then INSERT using PHP & MySQL
JavaScript works well for this. The function to use, if I remember correctly, is confirm().
Hope that helps. |
|
#3
|
|||
|
|||
|
RE: HTML form preview then INSERT using PHP & MySQL
Thanks but I don't know Javascript.
I'm just learning PHP, MySQL, SQL. This is all new to me. I do know HTML though The actions I want the user to take are as follows: 1) Fill out form. 2) Press Preview Button (the only button on that page). 3) Look over preview of text entered. (this should be on a new page and appear as text, not text in form fields.) 4a) If user finds mistake in text of Preview, click Edit button (or link or Browser back button) to go back to form and make changes. Then user repeats steps 1 (editing not re-entering data) through 4. 4b) If user does not find mistakes in text of Preview, clicks submit button that INSERTS form data into MySQL table. 5) User gets a new page thats says "thank you. form submitted." Does anyone know how I can get this to work? I already know how to INSERT form data into a table and ECHO the data onto a page after the data was inserted, but I can't figure out how to add the Preview in the middle before inserting the data. Thanks! |
|
#4
|
|||
|
|||
|
RE: HTML form preview then INSERT using PHP & MySQL
OK, well believe it or not you already know the "skills" to make this happen. Plus you already have defined the flow of things.
To create the page in the middle all you have to do is ECHO it back to the user in a non-form fields, like you said. But also ... when generating the html for this middle _DO_ create a form with input types as HIDDEN. Now when the user decides that the info is accurate and presses the SUBMIT button you can retrieve the data like you normally would from a form and insert it into your db. I hope that makes sense. |
|
#5
|
||||||||
|
||||||||
|
RE: HTML form preview then INSERT using PHP & MySQL
This is what the code would look like:
php Code:
php Code:
|
|
#6
|
|||
|
|||
|
RE: HTML form preview then INSERT using PHP & MySQL
EvilivE,
I did as you suggested, which by the way makes perfect sense. I'm sorry i could not figure that out. But I did get a error after submitting the form to preview.php, I must be doing some thing wrong. Here is the error I got: Parse error: parse error in /public/ContactUs/preview.php on line 29 Here are lines 28 and 29: <form method="POST" action="save.php"> <input type=hidden name="First_Name" value="<?Â*echoÂ*$_POST['First_Name']Â*?>"> What do you think could be wrong? Thanks for your help!!!! - steve |
|
#7
|
|||
|
|||
|
RE: HTML form preview then INSERT using PHP & MySQL
I figured it out! Since i had copied code from a forum web page, it some how copied over some invisible characters into my code. They can only be seen if i turn on the show invisibles feature of my text editor. Well, I took them out and then the code worked.
Thanks so much for all your help EvilivE! You really saved the day!!!! Take care. - Steve |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > HTML form preview then INSERT using PHP & MySQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|