Hello all,
I've had a good look around the forums/google and I cant find the solution to my problem, infact I've not even found anyone else mention it.
Anyway.
I'm pulling a list of applications out of a database, these application names have a check box next to them depending on weather or not they are enabled - This is not a problem, i'm using str_replace to make sure that spaces are replaced with underscores(_) and the script is building the correct HTML FORM code.
e.g:
application name in db = "Content Manager"
HTML code generated:
<input type=checkbox name="Content_Manager">Content Manager
<input type=text name="emfn_Content_Manager">
<input type=text name="mlID_Content_Manager">
However, when I submit my form to the next page i'm having trouble retreiving my dynamic field names.
e.g.
$sql_query = "SELECT * FROM applications_list";
$result = @mysql_query($sql_query) or die("<br>Invalid query: ". mysql_error());
while($row = mysql_fetch_array($result)) {
$checkbox_appname = str_replace(chr(32),"_",$row["application"]); // strip spaces for _
// here we build our own variables e.g. say appname_content_manager, emfn_content_manager, mlID_content_manager
${ 'appname_' . $checkbox_appname } = $checkbox_appname;
echo "<br>Should have just built: appname_" . $checkbox_appname;
${ 'emfn_' . $checkbox_appname } = $HTTP_POST_VARS["emfn_" . $checkbox_appname;];
echo "<br>Should have just built: emfn_" . $checkbox_appname;
${ 'mlID_' . $checkbox_appname } = $HTTP_POST_VARS["mlID_" . $checkbox_appname];
echo "<br>Should have just built: mlID_" . $checkbox_appname;
}
I dont think (infact i know) that im conacating the variables incorrectly on the $HTTP_POST_VARS but after trying every combination of '/.'"/{}/eval() I can think of and busting out the red "PHP4" bible this has had me stumped at work most of the day.
If anyone can shed any light on this you can have my babies 😃.
Thanks again,
Regards,
- iclebyte