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: ... All the way up to skills[10][...], or however many you want. If everything is filled out, you will then get

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 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 stateme

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[

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 wo

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

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

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
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 a

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 creatin

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 th

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 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
t; > 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. > > Gr

RE: [PHP] Validation problem with array.

2004-10-20 Thread Graham Cossey
rt 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 or iteration. > It's related to the validaton of those elements: >

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 INS

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? http://uk2.php.net/manua