...

View Full Version : Listing Values from Column with a <SELECT>



macpeace
09-11-2009, 05:48 PM
Hi all..

As I said before, iam learning this great programing language!!

Iam with this small problem. I am trying to get data from a table column to a <select> but i dont' now how to retrieve all the values...

I've got this...
---------------------------------------------------------------------
<?
include ("config.php");

$rSQL = mysql_query("SELECT * FROM categorias");

while($asData = mysql_fetch_array($rSQL))
{
$catDat = $asData[1];
$catDss = count ("$catDat");
}
?>
<label for "catg"><? print catsr;?></label><select name="catg" id="catg">
<option><? echo "$catDat";?></option>
</select>
<? mysql_close($con); ?>

angst
09-11-2009, 05:53 PM
echo "<select name=\"catg\" id=\"catg\">";
$rSQL = mysql_query("SELECT * FROM categorias");
while($asData = mysql_fetch_array($rSQL))
{
$catDat = $asData[1];
$catDss = count ("$catDat");

echo "<option>" . $catDat . "</option>";
}
echo "</select>";

macpeace
09-11-2009, 06:04 PM
so simple...

ok thanks again angst!

jegan2k9
09-17-2009, 09:09 AM
Hi macpeace,

This may help you,
<?
include ("config.php");

$rSQL = mysql_query("SELECT * FROM categorias");

while($asData = mysql_fetch_array($rSQL))
{
$catDat = $asData[1];
$catDss = count ("$catDat");
}
?>
<label for "catg"><? print catsr;?></label><select name="catg" id="catg">
<option value="<? echo "$catDat";?>"><? echo "$catDat";?></option>
</select>
<? mysql_close($con); ?>

Now you will get the values when submitting the form



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum