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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.