php mysql forms

I am trying to get a dropdown list populated by mysql to work for me. The list is populated from the database just fine, but isn’t passing it to the results page. Could someone have a look-see?

This part works fine. the dropdown is populated and looks ok but it doesn’t seem to be passing it to the next page.

[php]mysql_connect(‘localhost, ‘svcTools’, ‘’’’);
mysql_select_db(‘svcTools’);

$sql = “SELECT weight FROM cfm ORDER BY weight”;
$result = mysql_query($sql);

echo “

Pig Weight
”;
echo “”;
while ($row = mysql_fetch_array($result)) {

echo “<option value=’” . $row[‘weight’] . “’>” . $row[‘weight’] . “”;
}
echo “”;

?>[/php]

This part does not work.
[php]<?php
echo $_POST[‘weight’];
?>[/php]

this seems like it should be simple. thanks!

You’re missing a comma in the mysql_connect line.

Your missing the name for the drop down list,

[php]echo “”;[/php]

Should fix it.

astonecipher, you’re awesome! Goes to show even when you follow tutorials, they don’t aways lead you correctly. Thanks so much! have a great day! I know mine just got better.

It is very good at it. I feel like I’m reading a lot. It can be used in everyday life, really.

Sponsor our Newsletter | Privacy Policy | Terms of Service