RE: [PHP] Validation problem with array.

2004-10-21 Thread Stuart Felenstein
See below: --- Graham Cossey [EMAIL PROTECTED] wrote: Also, this line : foreach($_SESSION['skills'] as $key = $skill) could read foreach($skills as $key = $skill) as you have the line: $skills = $_SESSION['skills']; Same for skys and slus. Graham Graham, I've read this over and over and

Re: [PHP] Validation problem with array.

2004-10-21 Thread Andre Dubuc
Hi Stuart, I haven't followed your thread too closely, but I did see something that might be the cause of your problems: [snip] Let me show you how I set it all up. Remember it's a multi page form: So the form elements are: skills[], skys[], slus[] Then on the next page I have to still

Re: [PHP] Validation problem with array.

2004-10-21 Thread Stuart Felenstein
You mean why do i have $_SESSION['skills'] in the foreach ? Stuart --- Andre Dubuc [EMAIL PROTECTED] wrote: Hi Stuart, I haven't followed your thread too closely, but I did see something that might be the cause of your problems: [snip] Let me show you how I set it all up. Remember

RE: [PHP] Validation problem with array.

2004-10-21 Thread Graham Cossey
See inline: [snip] Now the transcation script: $skills = $_SESSION['skills']; $skys = $_SESSION['skys']; $slus = $_SESSION['slus']; foreach($_SESSION['skills'] as $key = $skill) ^^^ ($skills as $key = $skill) { if ($skill != '') // Has this skill

RE: [PHP] Validation problem with array.

2004-10-21 Thread Stuart Felenstein
Graham, I'm going to make those changes. Not sure if that was creating some crazy behaviour. See inline: --- Graham Cossey [EMAIL PROTECTED] wrote: { if ($skill != '') // Has this skill been entered? I don't know if I care if it's been entered. My main concern would

RE: [PHP] Validation problem with array.

2004-10-21 Thread Graham Cossey
See inline: [snip] { if ($skill != '') // Has this skill been entered? I don't know if I care if it's been entered. My main concern would be to make sure that if a $skill was entered, then a matching $skys and $slus should be: skills[0]-baker skys[0]-7

RE: [PHP] Validation problem with array.

2004-10-21 Thread Stuart Felenstein
See inline: --- Graham Cossey [EMAIL PROTECTED] wrote: In other words I need to figure out how to check that each line is complete. right now, it is matching all the values/inputs correctly. If someone just chose a slus, seems the database But is this due to the sql statement being

RE: [PHP] Validation problem with array.

2004-10-21 Thread Graham Cossey
[snip] Right now I have this [right below]: If I want to check for skys and slus, I add another set of braces with if($sky != '' ... and below end if ($sky != '') foreach($skills as $key = $skill) { if ($skill != '' $skys[$key] != '' $slus[$key] != '') {

Re: [PHP] Validation problem with array.

2004-10-21 Thread Brent Baisley
Since your data on the client is linked, you should keep it linked on submission by nesting an array with in the array. Your client HTML should like something like this: input type=text name=skills[0][skill] value= size=20 select name=skills[0][skys] size=1 option ... /select select

RE: [PHP] Validation problem with array.

2004-10-20 Thread Graham Cossey
Not sure I really know where you have the problem, but I am assuming you are trying to construct the INSERT statement within your foreach loop. If so, why use $_POST[skill[]] when you have $skill which is that current element being iterated? Did you read the foreach doc?

RE: [PHP] Validation problem with array.

2004-10-20 Thread Stuart Felenstein
My problem is not related to the insert or iteration. It's related to the validaton of those elements: skill[] skill[] etc. Clearer ? Stuart --- Graham Cossey [EMAIL PROTECTED] wrote: Not sure I really know where you have the problem, but I am assuming you are trying to construct the INSERT

RE: [PHP] Validation problem with array.

2004-10-20 Thread Graham Cossey
PROTECTED] Subject: RE: [PHP] Validation problem with array. My problem is not related to the insert or iteration. It's related to the validaton of those elements: skill[] skill[] etc. Clearer ? Stuart --- Graham Cossey [EMAIL PROTECTED] wrote: Not sure I really know where you have

RE: [PHP] Validation problem with array.

2004-10-20 Thread Stuart Felenstein
= $_SESSION['skills']; Same for skys and slus. Graham -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: 20 October 2004 14:06 To: Graham Cossey; [EMAIL PROTECTED] Subject: RE: [PHP] Validation problem with array. My problem is not related to the insert

Re: [PHP] Validation problem with array.

2004-10-20 Thread Brent Baisley
I think I might know what you are trying to do. You want to have a name associated with the skill (or skys or slus). You can use an associative array to name your array elements. In your form, you can change the array to be something like this: skills[cooking] skills[flying] skills[walking] ...

Re: [PHP] Validation problem with array.

2004-10-20 Thread Stuart Felenstein
Brent, Thank you , I can't do an associative because it part of a user input form. The values will be dependent on the users. I'm going to try and give each form element a index number skill[0], skill[1] since the foreach loop is doing that anyway. The reason I haven't posted the validation is

Re: [PHP] Validation problem with array.

2004-10-20 Thread Brent Baisley
I thought you were using checkboxes based on your true/false. So the user is actually typing in skills? Not sure where you are going with skill[0], skill[1]. You are creating an associative array when you do that. In and input form, skill[0] and skill[a] are actually no different, aside from

Re: [PHP] Validation problem with array.

2004-10-20 Thread Stuart Felenstein
Yes I just found that out :). Back to the drawing board!. Stuart --- Brent Baisley [EMAIL PROTECTED] wrote: I thought you were using checkboxes based on your true/false. So the user is actually typing in skills? Not sure where you are going with skill[0], skill[1]. You are creating an