CWeaver Posted February 2, 2006 Share Posted February 2, 2006 I'm successful in refering to the input values within a form by using code like this:Input form: <Form action="TestimonialApproval.php" method=post> <input type='text' size=90 name=TA[Testimonial][2] value='Second Event' /> Processing file(TestimonialApproval.php): echo "<BR />Testimonial Approval."; $ApprovedCount = 0; foreach ($TA as $Key => $Value) { if ($Key == "Testimonial") { foreach ($TA["Testimonial"] as $TAKey => $TAValue) { if ($TA["ApprovedCB"][$TAKey] == true) { $query = "update testimonials set Testimonial = '" . $TAValue . "', PatientID = " . $TA["PatientID"][$TAKey] . ", Approved = 1 where TestimonialID = " . $TA["TestimonialID"][$TAKey]; $result = mysql_query($query); if ($result) { $ApprovedCount++; }; } else { //echo "<BR /> Not Approved"; } } } } echo "<br /> Testimonials approved: " . $ApprovedCount; But when the input elements are within a table, the arrays don't work the same.Input side: <form action='CalendarEventEditProcessing.php' method='post' enctype='multipart/form-data' name='CalendarEventsEdit'> <table cellspacing="1" rowspacing="2" border="0" align="left"> <tr><td align="left" valign="middle" colspan=2> <input type='text' size=90 name=CEA[EventTitle][1] value='Second Event' /></td></tr> Processing (CalendarEventEditProcessing.php): foreach ($CEA as $Key => $Value) { echo "<br />" . $Key . " : " . $Value; if ($Key == "EventTitle") { foreach ($CEA["EventTitle"] as $CEAKey => $CEAValue) { echo "<br />" . $CEAValue . "title"; } } } What this produces isname : Arraytype : Arraytmp_name : Arrayerror : Arraysize : ArrayIt never finds the "EventTitle" key even though it's one of the indices.How can I grab the values of the CEA array as I have done with the TA array? Does this have to do with the CEA array being within a table?Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now