PHP Classes

drop down menu and checkbox

Recommend this page to a friend!

      Access user Class  >  All threads  >  drop down menu and checkbox  >  (Un) Subscribe thread alerts  
Subject:drop down menu and checkbox
Summary:Showing undefined index error
Messages:11
Author:ashok vas
Date:2004-12-25 14:22:40
Update:2007-08-09 11:45:59
 
  1 - 10   11 - 11  

  1. drop down menu and checkbox   Reply   Report abuse  
Picture of ashok vas ashok vas - 2004-12-25 14:22:40
Hi,
I am a newbie.I have built an application to collect data on models using the access_user class.I have increased the number of variables in the class to handle all the data in my application.
I have tried to use drop down menus and checkboxes for data entry.
I am getting the following problems when I try to update the information about the users(models,in my case)
1)With the checkboxes,I am getting 'undefined index'.The data is getting updated inthe database but this error is shown.Further,after the data is modified and I get the "Your account is modified" message,the data against the checked checkboxes does not show.(the checkboxes appear as unchecked).

2)With drop down menus,there is no error showing but the updated data does not show on the screen after the update is over.The default 'selected' option shows and not the option that the user has chosen.I have made the drop down with "select" as the 'selected' option.If I once again try to update with some other changes,the data for the dropdown fields get modified to the "selected" options and the original correct entries are overwritten.

If anyone can help,I can send the script to them by mail,as I dont know how I should display the code on this forum(it is large).

Thanking in advance

Regards

Aashok

  2. Re: drop down menu and checkbox   Reply   Report abuse  
Picture of Olaf Lederer Olaf Lederer - 2004-12-25 16:48:01 - In reply to message 1 from ashok vas
It's because the data of an unchecked box will not send or is empty. You have to use something like "if(isset($data)) { then do something } ".

I want to ask you again, this is not the place to asking general questions regarding PHP and this question is not related to this class.

Please post this kind of questions to one of the php forums.

  3. Re: drop down menu and checkbox   Reply   Report abuse  
Picture of ashok vas ashok vas - 2004-12-26 05:05:41 - In reply to message 2 from Olaf Lederer
Thanks and wish you a Merry Xmas.I shall try it out.

  4. Re: drop down menu and checkbox   Reply   Report abuse  
Picture of ashok vas ashok vas - 2004-12-27 10:22:49 - In reply to message 2 from Olaf Lederer
1)I tried looking at the general PHP forums and the solutions (two different types for 'wsh3' and 'wsh4')suggested were tried out by me as follows:"<INPUT TYPE="CHECKBOX" NAME="wsh3"<?php if($wsh3=="on"){echo"CHECKED";} ?>>Swim/Underwear</INPUT><br>
<INPUT TYPE="CHECKBOX" NAME="wsh4"<?php if(isset($_POST['wsh4'])||($update_member->user_wsh4=="on")){echo" CHECKED";}
else{"NULL";}?> > Event/SpokesModel</INPUT>".

They worked OK when the boxes were checked and also showed the existing value(checked) inthe database,but when they were unchecked,same error of 'undefined index' came.

I do not know whether the problem can be linked to the class,but I would be very thankful if some help could be given.


2)I also would like to create an admin page where the administrator can modify/edit/delete all entries for all users.What should I do here(something with the 'extra info' field-and how do I set up the admin account



Regards
Aashok

  5. Re: drop down menu and checkbox   Reply   Report abuse  
Picture of ashok vas ashok vas - 2004-12-27 10:31:44 - In reply to message 4 from ashok vas
I am sorry but I forgot to add the following code line which has been put in the page
"$wsh3 = !isset($_POST["wsh3"])?$update_member->user_wsh3: $_POST["wsh3"];"

Alongwith the above code in the earlier post.

Aashok

  6. Re: drop down menu and checkbox   Reply   Report abuse  
Picture of ashok vas ashok vas - 2004-12-29 14:06:30 - In reply to message 5 from ashok vas
urgent


The error I get when the checkboxes are not checked is

"Notice: Undefined index: exper1 in /home/httpd/vhosts/accordweb.info/httpdocs/access_user/update_user.php on line 11"

The application is working fine.
How do we disable this message from showing.

Please do help me out as I have really tried hard to solve the problem,but maybe I am too new.

Aashok


  7. Re: drop down menu and checkbox   Reply   Report abuse  
Picture of Olaf Lederer Olaf Lederer - 2004-12-29 21:46:30 - In reply to message 6 from ashok vas
Please read my first answer...

  8. Re: drop down menu and checkbox   Reply   Report abuse  
Picture of ashok vas ashok vas - 2004-12-30 02:37:15 - In reply to message 7 from Olaf Lederer
Thanks for replying but I still do not understand.I have already tried isset as shown above.
The problem is when the checkbox is not checked.
Sorry for bothering you with simple problems.

Thanks

Aashok

  9. Re: drop down menu and checkbox   Reply   Report abuse  
Picture of Olaf Lederer Olaf Lederer - 2004-12-30 07:51:44 - In reply to message 8 from ashok vas
Use the test in the row where you get the error, If you check my login example you will see how.

  10. Re: drop down menu and checkbox   Reply   Report abuse  
Picture of ashok vas ashok vas - 2005-01-01 04:08:10 - In reply to message 9 from Olaf Lederer
Thanks for your suggestion.

I tried as follows but still getting error

in the access_user class,

i set $var wsh4="no";

Then in the update_user.php page I added the following

if (isset($_POST['Submit'])) {
$update_member->user_wsh4 = (isset($_POST['wsh4'])) ? $_POST['wsh4'] : "no";

<INPUT TYPE="CHECKBOX" NAME="wsh4"<?php if($update_member->user_wsh4=="on"){echo" CHECKED";}
?> > Event/SpokesModel</INPUT>


I have looked at many PHP forums but not able to get answer.


WISH YOU A VERY HAPPY AND PROSPEROUS NEW YEAR


Aashok

 
  1 - 10   11 - 11