Jump to content

How to Get Data from HTML Listmenu then Insert into Database( Using PHP/MySQL)


sivanath.nagendran

Recommended Posts

Hi to all

      I am a newbie to php/mysql. Pls can anyone help me for this [b]" How to Get Data from HTML Listmenu then Insert into Database( Using PHP/MySQL) ".[/b]
  I mean If User select one option from Listmenu, then store that option value into Database using  PHP/ MySQL.

Advance thanks for helping.

By
Sivanath.N  :(
This depends what method you're using. Post? Get? Also....this would entail the very very basics of PHP. I suggest before diving in blindly...to at least do a little reading.

Take a look at:

http://us2.php.net/mysql_query

Start there...there are working examples and it will point you in the right direction through all the diferent mysql functions.
Agree with Caeser. The question is way too broad and open ended. It requires (1) knowing how to create HTML forms using the <form> tag and writing a php routine that will (2) validate the data from the submitted form and (3) update the database. That's three different areas of knowledge you have to know.

Suggest you do a search for on the terms "php" and "tutorial" and wade through the results. It will take doing your homework, but you'll find what you need to know.
Hi sir

      I recieve the listmenu option values from database, now is it possible for my previous quistion? I mean selected option I need to be stored into database.

  Pls help me, sorry for my English.

By
Sivanath.N
Hey sivanath,

w3schools.com has [url=http://www.w3schools.com/php/php_mysql_insert.asp]a tutorial[/url] that explains how to add to your database using some input boxes. Once you know how to do this, it's not too hard to apply it to a list box. It skips over evaluating the input, though. But it will get you off to a good start and should show some results pretty quickly.
Hi CAESAR

    <?php $sql = "SELECT eventType FROM srt_eventType";
$result = mysql_query($sql) or die ($sql . '<br />' . mysql_error);
if (!$result) {
echo 'Query failed';
exit;
}
if (mysql_num_rows($result)>0) {
echo '<select name="eventType">';
while($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['eventType'] . '">' . $row['eventType'] . '</option>';
}
echo '</select>';
} else {
echo 'No eventType created yet';
}
?>


I used this code for getting data from MySQL then insert that into Listmenu. Now I need help for how to I store the selected Item from Listmenu to Database?

Help me for this

By
Sivanath.N

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.