By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,968 Members | 1,684 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,968 IT Pros & Developers. It's quick & easy.

select box selections to database

P: 4
I have many entries in list box.
I am submitting form using post method to update.php.
Now i want all the entries present in the list box and put them in the database table using mysql.
please tell me the solution.
Feb 19 '08 #1
Share this Question
Share on Google+
2 Replies


Markus
Expert 5K+
P: 6,050
II have many entries in list box.
I am submitting form using post method to update.php.
Now i want all the entries present in the list box and put them in the database table using mysql.
please tell me the solution.
Here's as much as im giving you for now:
[php]
<?php
if(isset($_POST['submitIt']))
{
$_values = $_POST['listboxA'];
foreach( $_values AS $_x)
{
echo $_x . "<br />";
// here you would insert into database
}
}
else
{
?>
<html>
<head></head>
<body>
<form name="" action="" method="post">
<select name="listboxA[]" size="3" multiple="true">
<option value="Option 1" selected>Option 1</option>
<option value="Option 2">Option 2</option>
<option value="Option 3">Option 3</option>
<option value="Option 4">Option 4</option>
<option value="Option 5">Option 5</option>
</select>
<input type="submit" name="submitIt">
</form>
</body>
<?php
}
?>
[/php]
Here's a tutorial for getting you started on mysql.
Feb 19 '08 #2

P: 4
Here's as much as im giving you for now:
[php]
<?php
if(isset($_POST['submitIt']))
{
$_values = $_POST['listboxA'];
foreach( $_values AS $_x)
{
echo $_x . "<br />";
// here you would insert into database
}
}
else
{
?>
<html>
<head></head>
<body>
<form name="" action="" method="post">
<select name="listboxA[]" size="3" multiple="true">
<option value="Option 1" selected>Option 1</option>
<option value="Option 2">Option 2</option>
<option value="Option 3">Option 3</option>
<option value="Option 4">Option 4</option>
<option value="Option 5">Option 5</option>
</select>
<input type="submit" name="submitIt">
</form>
</body>
<?php
}
?>
[/php]
Here's a tutorial for getting you started on mysql.


Thanks For The Reply..
Apr 2 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.