[nycphp-talk] list() produces wrong values for variables when set from array
soazine at pop.erols.com
soazine at pop.erols.com
Mon Oct 6 18:11:39 EDT 2003
<?
$jobFieldsInfoArray = array('jobTitle|text|Job Title (if federal,
include series and grade)|50',
'jobStartDate|dategroup|Start Date|0',
'jobEndDate|dategroup|End Date|0',
'jobSalary|text|Salary (per annum)|10',
'jobHours|text|Hours per week|20',
'employerName|text|Employers Name|100',
'employerAddress|text|Employer Address|50',
'supervisorName|text|Supervisors Name|100',
'supervisorPhone|text|Supervisors Phone (enter either phone or
email)|50',
'supervisorEmail|text|Supervisors Email|50',
'canContactSupervisor|radio|You may contact this
supervisor|Y|N|Yes|No',
'jobDuties|textarea|10|60|Describe your duties and
Accomplishments'
);
for ($i = 0; $i < sizeof($jobFieldsInfoArray); $i++) {
$jobFieldsItemArray = explode('|', $jobFieldsInfoArray[$i]);
if (strcmp(strtolower($jobFieldsItemArray[1]), 'radio')) {
list($jobField, $jobFieldType, $jobFieldText, $jobFieldValue0,
$jobFieldValue1, $jobFieldAnswer0, $jobFieldAnswer1) = explode('|',
$jobFieldsInfoArray[$i]);
} elseif (strcmp(strtolower($jobFieldsItemArray[1]), 'textarea')) {
list($jobField, $jobFieldType, $jobRows, $jobCols, $jobFieldText) =
explode('|', $jobFieldsInfoArray[$i]);
} elseif (strcmp(strtolower($jobFieldsItemArray[1]), 'dategroup')) {
list($jobField, $jobFieldType, $jobFieldText, $junk) = explode('|',
$jobFieldsInfoArray[$i]);
} else {
list($jobField, $jobFieldType, $jobFieldText, $jobFieldMaxLength) =
explode('|', $jobFieldsInfoArray[$i]);
}
// DO OTHER STUFF WITH THE LISTED VARIABLES
}
?>
I am having to set up an HTML form page dynamically created by elements in
a "glued" array, the same way I've done it in TCL before, except that I'd
use a list instead of an array, but anyway..
Everything works until you get to the part where I am setting variables in
the list() function if it flags to 'radio'; there every single variable is
set to the wrong value! I have looked over my code now for a good hour and
I can't find what I did wrong, so I am going to have to get a second pair
of eyes to look at it and tell me what I missed.
Thanx
Phil
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
More information about the talk
mailing list