Ok, I'm getting a bit flustered (newbie), I have searched throughout the forums for help on this, but couldn't find anything posted that delt with a flat file and not a MySQL database.
I'm not able to have the select boxes display the correct selected value.
One page contains the input form and the other page stores the values.
Now on the form page, it has several dropdown lists that contain a list of colors besides other type of fields. When you go back to the form page, the fields automatically display the values in the fields, except the select boxes. They are not displaying the selected values. Heres what I have done:
My select box function
function color_select($color)
{
echo"<SELECT NAME=\"$color\">\n";
if($color == '$color')
{
echo"<OPTION VALUE=\"$color\" SELECTED>$color</OPTION>\n";
}
else
{
echo"<OPTION VALUE=\"#0000FF\">Blue</OPTION>\n"
."<OPTION VALUE=\"#000066\">Dark Blue</OPTION>\n"
."<OPTION VALUE=\"#0099FF\">Light Blue</OPTION>\n"
."<OPTION VALUE=\"#00FFFF\">Aqua</OPTION>\n"
."<OPTION VALUE=\"#660066\">Purple</OPTION>\n"
."<OPTION VALUE=\"#FF00FF\">Violet</OPTION>\n"
."<OPTION VALUE=\"#FF0000\">Red</OPTION>\n"
."<OPTION VALUE=\"#990000\">Dark Red</OPTION>\n"
."<OPTION VALUE=\"#FFFF00\">Yellow</OPTION>\n"
."<OPTION VALUE=\"#FFFFCC\">Light Yellow</OPTION>\n"
."<OPTION VALUE=\"#00FF00\">Green</OPTION>\n"
."<OPTION VALUE=\"#006600\">Dark Green</OPTION>\n"
."<OPTION VALUE=\"#CCFFCC\">Light Green</OPTION>\n"
."<OPTION VALUE=\"#FF9900\">Orange</OPTION>\n"
."<OPTION VALUE=\"#FFFFFF\">White</OPTION>\n"
."<OPTION VALUE=\"#000000\">Black</OPTION>\n"
."<OPTION VALUE=\"#CCCCCC\">Grey</OPTION>\n"
."<OPTION VALUE=\"#333333\">Dark Grey</OPTION>\n"
."<OPTION VALUE=\"#EEEEEE\">Light Grey</OPTION>\n"
."<OPTION VALUE=\"#996600\">Brown</OPTION>\n"
."</SELECT>\n";
}
}
The Input Form
//only part of script
echo"<tr><td><P>Background Color:</td><td>";
color_select('xpage_bg'); // Displays choice of colors for page background
echo"</td></tr>\n";
echo"<tr><td><P>Text Color:</td><td>\n";
color_select('xpage_text'); // Displays choice of colors for page text
echo"</td></tr>\n";
echo"<tr><td><P>Link Color:</td><td>\n";
color_select('xpage_link'); // Displays choice of colors for page links
echo"</td></tr>\n";
echo"<tr><td><P>Active Link Color</td><td>\n";
color_select('xpage_alink'); // Displays choice of colors for page active links
echo"</td></tr>\n";
echo"<tr><td><P>Visited Link Color</td><td>\n";
color_select('xpage_vlink'); // Displays choice of colors for page visted links
echo"</td></tr>\n";
Once submitted, the script gets processed like this
//only part of script
$content .= "\$page_bg = \"$xpage_bg\";\n";
$content .= "\$page_text = \"$xpage_text\";\n";
$content .= "\$page_link = \"$xpage_link\";\n";
$content .= "\$page_alink = \"$xpage_alink\";\n";
$content .= "\$page_vlink = \"$xpage_vlink\";\n";
The flat files stores it like this
//only part of script
$page_bg = "#FFFFCC";
$page_text = "#000000";
$page_link = "#0000FF";
$page_alink = "#00FFFF";
$page_vlink = "#000099";
Thanks for anyones help, I'm just not getting those select boxes to work right 🙁