Jump to content

PHP inside a form


matthew798

Recommended Posts

Hola boys!

 

<form action="" method="POST">
<table width="100%" border="0">
  <tr>
    <td> </td>
    <td>
    <span class="general">Subject: </span><input type="text" />
    <span class="general"># Prefix: </span><input type="text" />
    <span class="general">Room #: </span><input type="text" />
    <span class="general">Teacher: </span><select name="teacher">
    
<?php
$query = "SELECT name FROM teachers";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
echo '<option value="'.$row['name'].'">'.$row['name'].'</option>';
?>
</select>
    </td>
  </tr>
</table>
</form>

 

I only ever get one option in the drop down menu, and it's the first in the database. What am i doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/125556-php-inside-a-form/
Share on other sites

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.