On a previous page I have a textbox. Now the user enters in a number in that textbox and when the user submits the form it is posted into the next page. But what I want to know is how can I insert the number , into the database and do I place this code on the previous page when the textbox is or the next page where the number is posted?
In other words when user enters in a number in the textbox and submits the form, it navigates the user to the next page and displays the number on the next page but also inserts the number in the database.
The name of the table in the database is called ‘Session’ and the name of the field is ‘TotalMarks’
Below is the textbox on the previous page where user enters in a number:
<input type="text" id="txtMarks" name="textMarks" />
Below is the php code for the number which is posted into the next page:
if (isset($_POST['textMarks'])) {
$_SESSION['textMarks'] = $_POST['textMarks'];
}
the mysql code is standard, you just need to execute with with mysql_query
example to go on next page after submitting the form(not tested):
I hope this helps.
Also read tutorial http://www.w3schools.com/php/php_mysql_insert.asp
Good Luck.