im new here and in php coding as well..
sorry if im ask stupid question here..
i just need some help from you all because i have try find at google but i still didn't found the solution.
here is my question...
actually im developing a website for my company association for the election of committee members. in one part the user must select the username to vote as a chairman and etc. and the value ( name have been selected) i want insert into database. is there any specific coding php need to use toinsert the menu list name into database?
here is my coding ( in this code im take the data from my database to view all the list name - thats working good. but when i need to select the name and insert it...it dosen't working...and the database still empty...please help me...)
Expand|Select|Wrap|Line Numbers
- <form name="form1" method="post" action="">
- <table width="80%" border="1" align="center">
- <tr>
- <td colspan="5">my election.</td>
- </tr>
- <tr>
- <td width="2%"> </td>
- <td width="3%"> </td>
- <td colspan="3"> </td>
- </tr>
- <tr>
- <td> </td>
- <td colspan="4">Who you want to vote as a ......</td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- <td colspan="3"> </td>
- </tr>
- <tr>
- <td height="26"> </td>
- <td> </td>
- <td>Chairman</td>
- <td width="24%">
- <label>
- <select name="select1" id="select" >
- <?
- $sql = "select UserName from advlogin order by UserName ASC";
- $rs = mysql_query($sql) or die (mysql_error());
- if ($rs)
- {
- while ($rw = mysql_fetch_object($rs))
- {
- $UserName=$rw->UserName;
- ?>
- <option><? echo $UserName; ?> </option>
- <?
- }
- }
- ?>
- </select>
- </label>
- </td>
- <td width="39%"> </td>
- </tr>
- <tr>
- <td height="26"> </td>
- <td> </td>
- <td>Deputy Chairman</td>
- <td>
- <label>
- <select name="select2" id="select" >
- <?
- $sql = "select UserName from advlogin order by UserName ASC";
- $rs = mysql_query($sql) or die (mysql_error());
- if ($rs)
- {
- while ($rw = mysql_fetch_object($rs))
- {
- $UserName=$rw->UserName;
- ?>
- <option><? echo $UserName; ?> </option>
- <?
- }
- }
- ?>
- </select>
- </label>
- </td>
- <td> </td>
- </tr>
- <tr>
- <td height="26"> </td>
- <td> </td>
- <td>Secretary</td>
- <td>
- <label>
- <select name="select3" id="select" >
- <?
- $sql = "select UserName from advlogin order by UserName ASC";
- $rs = mysql_query($sql) or die (mysql_error());
- if ($rs)
- {
- while ($rw = mysql_fetch_object($rs))
- {
- $UserName=$rw->UserName;
- ?>
- <option><? echo $UserName; ?> </option>
- <?
- }
- }
- ?>
- </select>
- </label>
- </td>
- <td> </td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- <td>Treasurer</td>
- <td>
- <label>
- <select name="select4" id="select" >
- <?
- $sql = "select UserName from advlogin order by UserName ASC";
- $rs = mysql_query($sql) or die (mysql_error());
- if ($rs)
- {
- while ($rw = mysql_fetch_object($rs))
- {
- $UserName=$rw->UserName;
- ?>
- <option><? echo $UserName; ?> </option>
- <?
- }
- }
- ?>
- </select>
- </label>
- </td>
- <td> </td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- <td>Commitee Members</td>
- <td>
- <label>
- <select name="select5" id="select" >
- <?
- $sql = "select UserName from advlogin order by UserName ASC";
- $rs = mysql_query($sql) or die (mysql_error());
- if ($rs)
- {
- while ($rw = mysql_fetch_object($rs))
- {
- $UserName=$rw->UserName;
- ?>
- <option selected><? echo $UserName; ?> </option>
- <?
- }
- }
- ?>
- </select>
- </label>
- </td>
- <td> </td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- <td> </td>
- <td colspan="2"><label>
- <input type="submit" name="button" id="button" value="Submit">
- </label></td>
- </tr>
- <tr>
- <td height="23"> </td>
- <td> </td>
- <td width="16%"> </td>
- <td colspan="2"> </td>
- </tr>
- </table>
- </form>