how to retain list value on form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
om.bitsian
Forum Commoner
Posts: 36
Joined: Wed Sep 09, 2009 4:13 am

how to retain list value on form

Post by om.bitsian »

Hello friends
To retain value on PHP form , when i refresh page.......... i am using
<option value="4" <?php if ($_POST['emptyp'] == '4') { echo "selected='selected'"; }?> >1. (Helping staff)</option>
but its giving Notice: Undefined index 'emptyp'

please check the attached jpeg file

please suggest me what to do to retain the values on php form for drop down
Attachments
post.GIF
post.GIF (54.11 KiB) Viewed 161 times
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: how to retain list value on form

Post by jackpf »

Use isset().
om.bitsian
Forum Commoner
Posts: 36
Joined: Wed Sep 09, 2009 4:13 am

Re: how to retain list value on form

Post by om.bitsian »

thanks....
i am using <?php if (isset($_POST['emptyp']) && $_POST['emptyp'] == '2') { echo "selected='selected'"; }?>
Post Reply