From: Richard L. <ce...@l-...> - 2006-11-20 18:25:26
|
When you print/echo an array variable in PHP, all you get is "Array" If you want to see what's in the array, you need to use var_dump() on it. http://php.net/var_dump Almost for sure the data is there; You just aren't looking at it right. :-) On Sun, November 19, 2006 1:11 pm, Neil Rest wrote: > I'm adding a variable length list of additional entries to a > "Registration" data entry page. (Register a Group) > I put in javascript to put in as many sets of blanks as specified (I > had no control over layout design.), which gives my just the <input>s > I want. Since its a list, I made the entries arrays. > When I try to retrieve the arrays from $_POST, all that's there is > the string 'Array'. > > I need whatever ideas and/or suggestins you have! > > Thanks, > Neil > > > // GENERATED CODE (looks ok to me) > First Name 2:<br /> > <input type="text" name="groupFirstName[]" id="groupFirstName2" > class="email_form" > value="" size="50"><br /> > Last Name 2:<br /> > <input type="text" name="groupLastName[]" id="groupLastName2" > class="email_form" > value="" size="50"><br /> > School Name 2:<br /> > <input type="text" name="groupSchool[]" id="groupSchool2" > class="email_form" > value="" size="50"><br /> > <HR><br /> > First Name 3:<br /> > <input type="text" name="groupFirstName[]" id="groupFirstName3" > class="email_form" > value="" size="50"><br /> > Last Name 3:<br /> > <input type="text" name="groupLastName[]" id="groupLastName3" > class="email_form" > value="" size="50"><br /> > School Name 3:<br /> > <input type="text" name="groupSchool[]" id="groupSchool3" > class="email_form" > value="" size="50"><br /> > > > // INSERTION POINT IN PAGE -- "getlist" > <br /> > <input type="checkbox" name="registerothers" > id="registerothers" value="1" onclick="registerlist(this)" > style="margin:4px 2px 0px 0px; padding:0px" /> Are you > registering for others, too?<br /><br /> > <div name="regmore" id="regmore" > class="regmore" style="visibility:hidden; display:none;"> > <span > name="getnum" id="getnum" class="getnum"> > How many in your group, including > yourself?<br /> > <select id="group_count" > name="group_count" class="contact_form" onclick="grouplist(this)"> > <option > value="2" >2</option><option value="3" >3</option><option > value="4" >4</option><option value="5" >5</option> > <option > value="6" >6</option><option value="7" >7</option><option > value="8" >8</option><option value="9" >9</option><option > value="10" >10</option> > <option > value="11" >11</option><option value="12" >12</option><option > value="13" >13</option><option value="14" >14</option><option > value="15" >15</option> > <option > value="16" >16</option><option value="17" >17</option><option > value="18" >18</option><option value="19" >19</option><option > value="20" >20</option> > </select><br /> > <br /> > </span> > <span name="getlist" id="getlist" > class="getlist"></span> > </div> > > <br /><br /> > > > // JAVASCRIPT > function grouplist(groupcount) { > namedisplay=document.getElementById("getlist"); > groupnames=""; > for (i=2;i<=groupcount.value;i++) { > groupnames+='First Name '+i+':<br />'+"\n"; > groupnames+='<input type="text" > name="groupFirstName[]" class="email_form" value="" size="50"><br > />'+"\n"; > groupnames+='Last Name '+i+':<br />'+"\n"; > groupnames+='<input type="text" > name="groupLastName[]" class="email_form" value="" size="50"><br > />'+"\n"; > groupnames+='School Name '+i+':<br />'+"\n"; > groupnames+='<input type="text" > name="groupSchool[]" class="email_form" value="" size="50"><br > />'+"\n"; > if (i<groupcount.value) { > groupnames+='<HR><br />'+"\n"; > } > } > namedisplay.innerHTML=groupnames; > return true; > } > > > // CODE WHERE FAILURE OCCURS!! > if($_POST['registerothers'] == 1) { > $first_names = $_POST['groupFirstName']; > $last_names = $_POST['groupLastName']; > $schools = $_POST['groupSchool']; > if(isarray($first_names) and isarray($last_names)) { > unset($ind_array); > unset($reg_array); > for ($i=0; $i<count($first_names); $i++) { > if($first_names[i]<>'' and > $last_names[i]<>'') { > $ind_array['first_name'] = > $first_names[i]; > $ind_array['last_name'] = > $last_names[i]; > $ind_array['address1'] = > $schools[i]; > dbInsert('aic_temp_individual', > $ind_array); > > $reg_array['individual_id'] > = mysql_insert_id(); > dbInsert('aic_registrations', > $reg_array); > } > } > } > } > > > Neil > > -- > Nei...@rc... > > You can get more things done with a kind word and a gun than with a > kind word alone. > -- Al Capone > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > chiPHPug-discuss mailing list > chi...@li... > https://lists.sourceforge.net/lists/listinfo/chiphpug-discuss > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? |