Jump to content

plz help me here !!!


webtuto

Recommended Posts

hi

here im trying to post the outputs from the database in a <select>

here is the code --->

 

<?php 
$query="select * from groups order by id";  
$result=mysql_query($query);
$row=mysql_fetch_array($result);
$cat=$row[group];
?>
<option name="<?php echo $cat; ?>"><?php echo $cat; ?></option>
<tr><td><input type="submit" value="Send" name="send"></tr>
</select></tr>

but it gives just 1 output from the table , i want it to list me all the results !!!! *!*

Link to comment
https://forums.phpfreaks.com/topic/85172-plz-help-me-here/
Share on other sites

<?php 
$query="select * from groups order by id";  
$result=mysql_query($query);

while($row=mysql_fetch_array($result))
{
$cat=$row[group];

?>
<option name="<?php echo $cat; ?>"><?php echo $cat; ?></option>
<tr><td><input type="submit" value="Send" name="send"></tr>
</select></tr>
<?php
}
?>

 

I think that will work

Link to comment
https://forums.phpfreaks.com/topic/85172-plz-help-me-here/#findComment-434542
Share on other sites

<?php 
$query="select * from groups order by id";  
$result=mysql_query($query);

while($row=mysql_fetch_array($result))
{
$cat=$row[group];

?>
<option name="<?= $cat ?>"><?= $cat ?></option>
<?php
}
?>
<tr><td><input type="submit" value="Send" name="send"></tr>
</select></tr>

Link to comment
https://forums.phpfreaks.com/topic/85172-plz-help-me-here/#findComment-434553
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.