PHP & MySQL
-
Hi guys! I need your help ! I'm doing a form in PHP and a want to display in my dropdownlist name column from my DB and save the name_id of that name selected from dropdownlist in DB. Here is my code
if(isset($_POST["submit"]))
{
$bookshop_id = mysql_real_escape_string($_POST["bookshop_id"]);
$book_id = mysql_real_escape_string($_POST["book_id"]);
$quantity = mysql_real_escape_string($_POST["quantity"]);mysql_query("INSERT INTO `books_bookshop`(`bookshop_id`,`book_id`,`quantity`)
VALUES ('" . $bookshop_id . "','" . $book_id . "','" . $quantity . "')")
or die ("Book could not be registered.");}
?>
Bookshop Name
-
Hi guys! I need your help ! I'm doing a form in PHP and a want to display in my dropdownlist name column from my DB and save the name_id of that name selected from dropdownlist in DB. Here is my code
if(isset($_POST["submit"]))
{
$bookshop_id = mysql_real_escape_string($_POST["bookshop_id"]);
$book_id = mysql_real_escape_string($_POST["book_id"]);
$quantity = mysql_real_escape_string($_POST["quantity"]);mysql_query("INSERT INTO `books_bookshop`(`bookshop_id`,`book_id`,`quantity`)
VALUES ('" . $bookshop_id . "','" . $book_id . "','" . $quantity . "')")
or die ("Book could not be registered.");}
?>
Bookshop Name
-
<form method="post" action="#">
<label for="bookshop_id">Bookshop Name</label>
<select style="width:148px;" id="bookshop_id" name="bookshop_id" value="bookshop_id" > -
Hi guys! I need your help ! I'm doing a form in PHP and a want to display in my dropdownlist name column from my DB and save the name_id of that name selected from dropdownlist in DB. Here is my code
if(isset($_POST["submit"]))
{
$bookshop_id = mysql_real_escape_string($_POST["bookshop_id"]);
$book_id = mysql_real_escape_string($_POST["book_id"]);
$quantity = mysql_real_escape_string($_POST["quantity"]);mysql_query("INSERT INTO `books_bookshop`(`bookshop_id`,`book_id`,`quantity`)
VALUES ('" . $bookshop_id . "','" . $book_id . "','" . $quantity . "')")
or die ("Book could not be registered.");}
?>
Bookshop Name
-
Hi guys! I need your help ! I'm doing a form in PHP and a want to display in my dropdownlist name column from my DB and save the name_id of that name selected from dropdownlist in DB. Here is my code
if(isset($_POST["submit"]))
{
$bookshop_id = mysql_real_escape_string($_POST["bookshop_id"]);
$book_id = mysql_real_escape_string($_POST["book_id"]);
$quantity = mysql_real_escape_string($_POST["quantity"]);mysql_query("INSERT INTO `books_bookshop`(`bookshop_id`,`book_id`,`quantity`)
VALUES ('" . $bookshop_id . "','" . $book_id . "','" . $quantity . "')")
or die ("Book could not be registered.");}
?>
Bookshop Name
You know that mysql_ is deprecated for long, right ? "Warning This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include: mysqli_query() PDO::query() " Source http://php.net/manual/en/function.mysql-query.php[^]