I have a MySQL table of error codes with three columns:
error_code, page, and error_msg.
On checking for errors I create an array called $error with all the error codes generated. I then use a
foreach ($error as $error_code) {get_error($error_code, $page); }
The get_error function connects to the db and echos the error message. I also need to have the function create a variable named after the error code. ie $error1, $error2, $error3, etc... that the script can look for in order to modify the output to show where the error is. ie.
$errorstyle = "background:yellow;";
// many lines later
echo"
Address: <INPUT TYPE='text' NAME='address' VALUE='$address' STYLE='";
if ($error1) {echo $errorstyle;}
echo"'>";
inside of HTML tags to change the background color for highlighting purposes.
This is where I am lost... is there a way to create a variable named after another variable...?
The only option I have right now if to use an if, else if, and specify every single error in the code (if this is the case I could just get rid of the table in the db for the error codes and put it all hard coded.... but I would really like to avoid this as it is really long coding and it basically defeats the purpose of dynamic content...
Any help on this issue is much appreciated, Thanks,
-Jesse