Trouble pre-populating drop down and textarea from MySQL Database

Posted by Tony on Stack Overflow See other posts from Stack Overflow or by Tony
Published on 2010-03-30T02:43:58Z Indexed on 2010/03/30 3:03 UTC
Read the original article Hit count: 495

Filed under:
|

I am able to successfully pre-populate my questions using the following code: First Name: <input type="text" name="first_name" size="30" maxlength="20" value="' . $row[2] . '" /><br />

However, when I try to do the same for a drop down box and a textarea box, nothing is pre-populated from the database, even though there is actual content in the database. This is the code I'm using for the drop down and textarea, respectively:

<?php echo ' <form action ="edit_contact.php" method="post"> <div class="contactfirstcolumn"> Prefix: <select name = "prefix" value="' . $row[0] . '" /> <option value="blank">--</option> <option value="Dr">Dr.</option> <option value="Mr">Mr.</option> <option value="Mrs">Mrs.</option> <option value="Ms">Ms.</option> </select><br />'; ?>

AND

Contact Description:<textarea id = "contactdesc" name="contactdesc" rows="3" cols="50" value="' . $row[20] . '" /></textarea><br /><br />

It's important to note that I am not receiving any errors. The form loads fine, however without the data for the drop down and textarea fields.

Thanks! Tony

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql