Hi, I have an combo box and I want to make it insert the value we choose to the database.
How can we do that?
thanks in advance
<?php if (!isset($_POST['submit'])) { echo ' <form action="" method="POST"> choose number:<br> <select name="number"> <option>1 <option>2 <option>3 <option>4 <option>5 </select><br> <input type="submit" name="submit" value="submit"> </form> '; } else { // connect to db here $result = mysql_query('INSERT INTO table SET number = ' . $_POST['number']) or exit(mysql_error()); echo $_POST['number'] . ' successfully inserted'; } ?>
sorry but I can't make it work. i've connected to the database corect the table name and field of the table like this
$result = mysql_query('INSERT INTO table('field') SET number = ' . $_POST['number']) or exit(mysql_error());
but It wont work 🙁