I am trying to build a new variable from an array for error checking. Below is my code.
} else if ($todo == "do_add"){
$missing_array = array();
$required_array = array("job_number","open","client_code","client","job_title","agency_contact","client_contact","type","output","size","quantity","colors","lengths","budget","concept","due","scope","primary","secondary","desired_response","positioning","main_selling","tone","sacred_cow","must_include","background");
$c = 0;
while ($c <= 25){
if ($$required_array[$c] == ""){
$add = "no";
$missing_array = ($required_array[$c]);
}
$c++;
}
if ($add == "no"){
$c = 0;
$missing_count = count($missing_array);
while ($c <= $missing_array){
echo "$missing_array[$c] <BR>";
${$missing_array[$c]."_error"} = "class='red'";
$c++;
}
include("add.php");
} else {
// error checking done. add to database
echo "Added to database";
}
}
I am trying to to take
${$missing_array[$c]."_error"} = "class='red'";
and build a variable called
$job_number_error that contains class='red' if $job_number is empty.
I am not sure how the syntax works. Thanks for anyany help.