Problem with drop down box

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

Problem with drop down box

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 bmp file

please suggest me what to do to retain the values on php form for drop down
iamngk
Forum Commoner
Posts: 50
Joined: Mon Jun 29, 2009 2:20 am

Re: Problem with drop down box

Post by iamngk »

add isset function :

Code: Select all

<option value="4" <?php if (isset($_POST['emptyp']) && $_POST['emptyp'] == '4') { echo "selected='selected'"; }?> >1. (Helping staff)</option>
om.bitsian
Forum Commoner
Posts: 36
Joined: Wed Sep 09, 2009 4:13 am

Re: Problem with drop down box

Post by om.bitsian »

thanks iamngk....its working
by mistake i have post the same problem twice
Post Reply