RE: [PHP-DB] Processing web forms

From: Date: Sun, 16 Apr 2006 18:05:21 +0000
Subject: RE: [PHP-DB] Processing web forms
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-41712@lists.php.net to get a copy of this message
Ah i getcha. Checkboxes only have a few options as values (On, or a value that you give it (like 1). Personally I tend to use (esp for items like permissions that are either on or off) a value of 1. Then if its 1, I know that the box was checked and that is what the user wants to have. $3 = $_POST['3']; would be the way to access that element Now if you are using a db to create the form in the first place, you can use that same call to loop thru the post array, instead of echoing it out. Is that clearer? Bastien
From: "ron.php" <ron.php@actsministries.org> To: bastien_k@hotmail.com CC: php-db@lists.php.net Subject: RE: [PHP-DB] Processing web forms Date: Sun, 16 Apr 2006 10:02:09 -0400 Good morning Bastien This doesn't help. I am having no problems creating the form of what the current permissions are based on the permission access table. I am not sure what to do with the form once it has been submitted. I am able to create the table which shows each permission function and what the current values are. Take a look at the name= fields; "Discipleship & Follow Up" is a category, the 2 functions being granted permission are the Christian Ministry & Business Directory Administration and the Verse of the Day Administration. <tr><td><font face="times new roman">Discipleship & Follow Up</td> <td><font face="times new roman"><table><tr><td width="80%"><input type="checkbox" name="3" checked="checked"> Christian Ministry and Business Directory Administration</td><td width="20%"><input type=text name="performance_review_3" value="2006-03-11" size=10 maxlength=10></td></tr> <tr><td width="80%"><input type="checkbox" name="1" checked="checked"> Verse of the Day Administration</td><td width="20%"><input type=text name="performance_review_1" value="2006-03-08" size=10 maxlength=10></td></tr> My problem is that I am not sure how to find out the value of $3 and $performance_review_3 when the form has been submitted. The reason I am having problems is because the # changes --- it is 3 and 1 in the above example. What I want to do is a SELECT * using the logged in user's reference number as the searching criteria ... then take a look at what was just submitted and then see if there is a difference. If there is a difference make what was submitted through the form (above) reality. I am going to query the table that generated the form (above) --- it knows how many components there are and then I could use a $i=0; WHILE $i < $number_of_permissions { ++$i; } What troubles me is that $i isn't $3 and I am not sure how to retrieve the value of $3 when $i isn't the same variable name. Ron


« previous php.db (#41712) next »