From one of the form pages on my site, I took the form values ($_POST) on the receiving action page and passed them thru to yet another page by using hidden inputs. There, on the third page, I was unable to break down the array so I could manipulate the values individually and I was hoping that someone could help me see the light! Here's the code:
//In "do_updatelog.php", after checking for required fields from the the
//previous form page, I initialized new variables:
<?php
$name = $POST[name];
$worklocation_description = $POST[worklocation_description];
$work_type = $POST[work_type];
$jobstatus_id = $POST[jobstatus_id];
$log_entry = $POST[log_entry];
$cost = $POST[cost];
$hour_in = $POST[hour_in];
$minute_in = $POST[minute_in];
$hour_out = $POST[hour_out];
$minute_out = $POST[minute_out];
//inserted them into the following hidden input, and sent them on to the next page
echo <<<ARCHECK
<FORM method="POST" action="ar_shosuccess.php">
<INPUT type="hidden" name="ar_question" value='$worlocdes'>
<INPUT type="hidden" name="ar_passthru[]" value='$name'>
<INPUT type="hidden" name="ar_passthru[]" value='$worklocation_description'>
<INPUT type="hidden" name="ar_passthru[]" value='$work_type'>
<INPUT type="hidden" name="ar_passthru[]" value='$jobstatus_id'>
<INPUT type="hidden" name="ar_passthru[]" value='$log_entry'>
<INPUT type="hidden" name="ar_passthru[]" value='$cost'>
<INPUT type="hidden" name="ar_passthru[]" value='$hour_in'>
<INPUT type="hidden" name="ar_passthru[]" value='$minute_in'>
<INPUT type="hidden" name="ar_passthru[]" value='$hour_out'>
<INPUT type="hidden" name="ar_passthru[]" value='$minute_out'>
<div id="archeck"><h2>Program Note!</h2>Asset Records exist for this
location. Would you like to link this Work Ticket to one of the available
Asset Records?<br /><p></p>
<INPUT type="radio" name="link_choice" value="yshoar">Yes, show me what Asset Records are available for this location so that I may link this
Work Ticket.<br /><p></p>
<INPUT type="radio" name="link_choice" value="nshoar">No Thank You, Please submit my Work Ticket now!
<INPUT type="image" src="/trentrakker.html/tt_image/Image40.gif"
alt="Submit Entry!" border="0" class = "mouseBeOffMe"
onmouseover = "this.className='mouseBeOnMe'"
onmousedown = "this.className='mouseBeDown'"
onmouseup = "this.className='mouseBeUp'"
onmouseout = "this.className='mouseBeOffMe'" />
</div>
</FORM>
ARCHECK;
//and in "ar_shosuccess.php" I tried several ways to retrieve the individual
//values...here is one way
$ar_value = implode("",$_POST[ar_passthru]);
echo "$ar_value[0]";
//All I get on the print out is the first letter of the first
//value, I also tried this...
//
//CHECK FOR VALUE
if(isset($POST[ar_passthru]) && $POST[ar_passthru]!='none') {
//
//CHECK FOR ARRAY
if(is_array($_POST[ar_passthru])) {
//
//FORMAT WORKTICKET ARRAY AND SET VARIABLES
while (list($key,$value) = each($_POST[ar_passthru]))
$slice1 = array_slice($POST[ar_passthru],0,1);
$slice2 = array_slice($POST[ar_passthru],1,1);
$slice3 = array_slice($POST[ar_passthru],2,1);
$slice4 = array_slice($POST[ar_passthru],3,1);
$slice5 = array_slice($POST[ar_passthru],4,1);
$slice6 = array_slice($POST[ar_passthru],5,1);
$slice7 = array_slice($POST[ar_passthru],6,1);
$slice8 = array_slice($POST[ar_passthru],7,1);
$slice9 = array_slice($POST[ar_passthru],8,1);
$slice10 = array_slice($POST[ar_passthru],9);
while (list($key,$value) = each($slice1)) {
$name = $value;
echo "$name<br />";
}
while (list($key,$value) = each($slice2)) {
$worklocation_description = $value;
echo "$worklocation_description<br />";
}
while (list($key,$value) = each($slice3)) {
$work_type = $value;
echo "$work_type<br />";
}
while (list($key,$value) = each($slice4)) {
$jobstatus_id = $value;
echo "$jobstatus_id<br />";
}
while (list($key,$value) = each($slice5)) {
$log_entry = $value;
echo "$log_entry<br />";
}
while (list($key,$value) = each($slice6)) {
$cost = $value;
echo "$cost<br />";
}
while (list($key,$value) = each($slice7)) {
$hour_in = $value;
echo "$hour_in<br />";
}
while (list($key,$value) = each($slice8)) {
$minute_in = $value;
echo "$minute_in<br />";
}
while (list($key,$value) = each($slice9)) {
$hour_out = $value;
echo "$hour_out<br />";
}
while (list($key,$value) = each($slice10)) {
$minute_out = $value;
echo "$minute_out<br />";
}
}
}
//At least with this method, I can print each of the values of the array
//however when I tried to work with each value individually, i.e......
//
//VALIDATE NAME++++++++++++++++++++++++++++++++++
$trimmed_name = trim($name);
$checkname = mysql_query("SELECT name FROM personal_info WHERE name = '$trimmed_name'");
$checkname = mysql_num_rows($checkname);
if($checkname<1) {
//
//ERROR & RETURN BUTTON
die(" <p></p>
<a href=\"/trentrakker.html/ttindex.php\"><img alt=\"return to main menu\"
border=\"0\" src=\"/trentrakker.html/tt_image/returnmenu4_30.gif\" /></a>
<div id=\"error\"><h2>Program Error!!</h2><span id=\"errorbody\">You have
entered an incorrect mechanic's name! Please click on the \"back\" button
and enter correct name.</span><br /><span
id=\"errornum\">error#tt+2+</span></div> ");
} else {
$cleanname = $valname;
}
?>
I get the following warning on my webpage
MySQL result resource in /home/www.carlpjohnson/trentrakker.html/workticket/ar_shosuccess.php on line 167"[/COLOR]
At this point, I'm just really frustrated and hope someone can assist. Carl