0

Hi!
I have a form, where you can choose between 5 titles of books. Under it you have a submit button.
My question is:
how to make so, that when the customer has chosen a book and clicks on the submit button, the title of the book to be inserted(recorded) in a db table.
I suppose it should be smth connected with if clause and INSERT INTO , but i'm not sure for the syntax.
Thank you, very, very much for the help!!!

4
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by jsrpatna
0

Use this code:
this code will execute after user clicks on the submit button.

if($_SERVER['REQUEST_METHOD']=='POST')
{
mysql_query("insert query");
}
0

Hi,

Shanti is very much right. You should just rephrase it. Declare a separate variable.

$selection = $_REQUEST['select'];
if($selection != null)
... Insert into database;

That's it! You might want to add some security here and validate $selection.

All the best!
References:-http://www.tutorialindia.com/php_mysql/index.php

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.