Page 1 of 1

help required

Posted: Mon Dec 29, 2003 12:28 am
by dakkonz
I need the form to auntomatically display whatever info is obtained from the database for me to edit......
I have tried but i still face problem.... can someone help me check??

$dbvalue= {$row['country']};

<select name="cnty">
<OPTION VALUE="">None
<OPTION VALUE="Afghanistan" <?php if (isset($dbvalue) && $dbvalue == "Afghanistan") echo 'selected="selected"'; ?>>Afghanistan
<OPTION VALUE="Albania" <?php if (isset($dbvalue) && $dbvalue == "Albania") echo 'selected="selected"'; ?>>Albania

Yah and one more problem i face.... why is it that when my edit form obtain info from the database it omits everything after a space??
eg name in database : Johnny Lim
display in form : Johnny

Posted: Mon Dec 29, 2003 12:40 am
by microthick
Try this instead:
<OPTION VALUE="Albania" <?php if (isset($dbvalue) && $dbvalue == "Albania") echo 'SELECTED'; ?>>Albania

Also, for your second question, make sure you are putting quotes around the value.

Like, you are probably doing this:

<input type="text" name="firstname" value=<?php echo $dbvalue ?>>

Change it to:

<input type="text" name="firstname" value="<?php echo $dbvalue ?>">

Posted: Mon Dec 29, 2003 1:31 am
by m3mn0n
Did you do any formatting to the name before it was inserted? Post the code that extracts the partial name...

Posted: Mon Dec 29, 2003 5:28 am
by dakkonz
oh i had it settled already...thanks a million :D