smiddies.co.uk Posted September 14, 2007 Share Posted September 14, 2007 i think this is in the right section please excuse me if its not please help me with this script it will not work and i dont know why, but when i submit the data then it saves it but doesnt bring up a page, but heres the code <? include"../config.php"; $qData = "select * from `settings` where `ID` = '1'"; $rData = mysql_query($qData) or die(mysql_error()); if(mysql_num_rows($rData) == '0') { echo "<br><center><b>No record found in database.</b></center>"; } else { $aData = mysql_fetch_array($rData); if(isset($_POST[Are])) { $Website_Name = $_POST[Website_Name]; $Website_Address = $_POST[Website_Address]; $Email_Address = $_POST[Email_Address]; $Title = $_POST[Title]; $Description = $_POST[Description]; $Background_Color = $_POST[background_Color]; $Title_Text_Color = $_POST[Title_Text_Color]; $Description_Text_Color = $_POST[Description_Text_Color]; $Other_Text_Color = $_POST[Other_Text_Color]; $Hyperlink_Color = $_POST[Hyperlink_Color]; $Visited_Link_Color = $_POST[Visited_Link_Color]; $bordcolour =$_POST[bordcolour]; $Layout_Settings = $_POST[Layout_Settings]; $Columns_per_Page = $_POST[Columns_per_Page]; $Rows_per_Page = $_POST[Rows_per_Page]; $Thumbnail_Image_width_height = $_POST[Thumbnail_Image_width_height]; $Thumb_Size = $_POST[Thumb_Size]; $Space_between_thumbs = $_POST[space_between_thumbs]; $Other_Settings = $_POST[Other_Settings]; $Display_File_name = $_POST[Display_File_name]; $Sort_File = $_POST[sort_File]; $Show_full_sized_image = $_POST[show_full_sized_image]; $Popup_windowx = $_POST[Popup_windowx]; $Popup_windowy = $_POST[Popup_windowy]; $Popup_window = "$Popup_windowx x $Popup_windowy"; $Footer_Message = $_POST[Footer_Message]; $t = time(); $q1 = "update `settings` set `Website_Name` = '$Website_Name' , `Website_Address` = '$Website_Address' , `Email_Address` = '$Email_Address' , `Title` = '$Title' , `Description` = '$Description' , `Background_Color` = '$Background_Color' , `Title_Text_Color` = '$Title_Text_Color' , `Description_Text_Color` = '$Description_Text_Color' , `Other_Text_Color` = '$Other_Text_Color' , `Hyperlink_Color` = '$Hyperlink_Color' , `Visited_Link_Color` = '$Visited_Link_Color' , `bordcolour` = '$bordcolour' , `Layout_Settings` = '$Layout_Settings' , `Columns_per_Page` = '$Columns_per_Page' , `Rows_per_Page` = '$Rows_per_Page' , `Thumbnail_Image_width_height` = '$Thumbnail_Image_width_height' , `Thumb_Size` = '$Thumb_Size' , `Space_between_thumbs` = '$Space_between_thumbs' , `Other_Settings` = '$Other_Settings' , `Display_File_name` = '$Display_File_name' , `Sort_File` = '$Sort_File' , `Show_full_sized_image` = '$Show_full_sized_image' , `Popup_window` = '$Popup_window' , `Footer_Message` = '$Footer_Message' where `ID` = '1'"; mysql_query($q1) or die(mysql_error()); header("location:settings.php"); } else { include("header.php"); echo "<h1>Settings</h1>"; if($aData[Thumbnail_Image_width_height] == Width) { $CheckedThumbnail_Image_width_height0 = "checked"; } elseif($aData[Thumbnail_Image_width_height] == Height) { $CheckedThumbnail_Image_width_height1 = "checked"; } if($aData[Display_File_name] == Yes) { $CheckedDisplay_File_name0 = "checked"; } elseif($aData[Display_File_name] == No) { $CheckedDisplay_File_name1 = "checked"; } if($aData[show_full_sized_image] == Yes) { $CheckedShow_full_sized_image0 = "checked"; } elseif($aData[show_full_sized_image] == No) { $CheckedShow_full_sized_image1 = "checked"; } $WidthHeight = explode(" x ","$aData[Popup_window]"); ?> <script language="JavaScript"> function settings(theForm) { if (theForm.Website_Name.value == "") { alert("Please enter your Website Name."); theForm.Website_Name.focus(); return (false); } if (theForm.Website_Address.value == "") { alert("Please enter your Website Address."); theForm.Website_Address.focus(); return (false); } if (theForm.Email_Address.value == "") { alert("Please enter your Email Address."); theForm.Email_Address.focus(); return (false); } var checkEmail = "@."; var checkStr = theForm.Email_Address.value; var EmailValid = false; var EmailAt = false; var EmailPeriod = false; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkEmail.length; j++) { if (ch == checkEmail.charAt(j) && ch == "@") EmailAt = true; if (ch == checkEmail.charAt(j) && ch == ".") EmailPeriod = true; if (EmailAt && EmailPeriod) break; if (j == checkEmail.length) break; } if (EmailAt && EmailPeriod) { EmailValid = true break; } } if (!EmailValid) { alert("Please enter Valid Email Address"); theForm.Email_Address.focus(); return (false); } if (theForm.Title.value == "") { alert("Please enter your Title."); theForm.Title.focus(); return (false); } if (theForm.Description.value == "") { alert("Please enter your Description."); theForm.Description.focus(); return (false); } if (theForm.Background_Color.value == "") { alert("Please enter your Background Color."); theForm.Background_Color.focus(); return (false); } if (theForm.Title_Text_Color.value == "") { alert("Please enter your Title Text Color."); theForm.Title_Text_Color.focus(); return (false); } if (theForm.Description_Text_Color.value == "") { alert("Please enter your Description Text Color."); theForm.Description_Text_Color.focus(); return (false); } if (theForm.Other_Text_Color.value == "") { alert("Please enter your Other Text Colour."); theForm.Other_Text_Color.focus(); return (false); } if (theForm.Hyperlink_Color.value == "") { alert("Please enter your Hyperlink Colour."); theForm.Hyperlink_Color.focus(); return (false); } if (theForm.Visited_Link_Color.value == "") { alert("Please enter your Visited Link Colour."); theForm.Visited_Link_Color.focus(); return (false); } if (theForm.bordcolour == "") { alert("Please enter the Table border Colour."); theForm.bordcolour.focus(); return (false); } if (theForm.Columns_per_Page.value == "") { alert("Please enter your Columns per Page."); theForm.Columns_per_Page.focus(); return (false); } if (theForm.Rows_per_Page.value == "") { alert("Please enter your Rows per Page."); theForm.Rows_per_Page.focus(); return (false); } if (theForm.Space_between_thumbs.value == "") { alert("Please enter your Space between thumbs."); theForm.Space_between_thumbs.focus(); return (false); } if (theForm.Popup_windowx.value == "") { alert("Please enter your Popup windowx."); theForm.Popup_windowx.focus(); return (false); } if (theForm.Popup_windowy.value == "") { alert("Please enter your Popup windowy."); theForm.Popup_windowy.focus(); return (false); } if (theForm.Footer_Message.value == "") { alert("Please enter your Footer Message."); theForm.Footer_Message.focus(); return (false); } } </script> This is where you can change the desing of the page. Simply click pick and choose the colour. Easy <form name="form1" method="POST" enctype="multipart/form-data" action="settings.php" onsubmit="return settings(this)"> <hr /> <center> <strong> Do Not Edit Below this unless you need to </strong> </center> <table border="0" width="600"> <tr> <td width="252">Website Name:</td> <td width="549"><input type="text" name="Website_Name" size="25" value="<?=$aData[Website_Name]?>" maxlength="150"></td> </tr> <tr> <td width="252">Website Address:</td> <td width="549"><input type="text" name="Website_Address" size="25" value="<?=$aData[Website_Address]?>" maxlength="150"></td> </tr> <tr> <td width="252">Email Address:</td> <td width="549"><input type="text" name="Email_Address" size="25" value="<?=$aData[Email_Address]?>" maxlength="150"></td> </tr> </table> <hr /> <center> <strong>Can Edit below this</strong> </center> <table border="0" width="600"> <tr> <td width="252">Title:</td> <td width="549"><input type="text" name="Title" size="25" value="<?=$aData[Title]?>" maxlength="150"></td> </tr> <tr> <td width="252">Description:</td> <td width="549"><input type="text" name="Description" size="25" value="<?=$aData[Description]?>" maxlength="150"></td> </tr> <tr> <td width="252">Background Colour:</td> <td width="549"><input type="text" name="Background_Color" size="8" value="<?=$aData[background_Color]?>" id="Background_Color" maxlength="7"> <a href="javascript: openPallete('Background_Color', 0, true)">Pick!</a></td> </tr> <tr> <td width="252">Title Text Colour:</td> <td width="549"><input type="text" name="Title_Text_Color" size="8" value="<?=$aData[Title_Text_Color]?>" id="Title_Text_Color" maxlength="7"> <a href="javascript: openPallete('Title_Text_Color', 0, true)">Pick!</a></td> </tr> <tr> <td width="252">Description Text Colour:</td> <td width="549"><input type="text" name="Description_Text_Color" size="8" value="<?=$aData[Description_Text_Color]?>" id="Description_Text_Color" maxlength="7"> <a href="javascript: openPallete('Description_Text_Color', 0, true)">Pick!</a></td> </tr> <tr> <td width="252">Other Text Colour:</td> <td width="549"><input type="text" name="Other_Text_Color" size="8" value="<?=$aData[Other_Text_Color]?>" id="Other_Text_Color" maxlength="7"> <a href="javascript: openPallete('Other_Text_Color', 0, true)">Pick!</a></td> </tr> <tr> <td width="252">Hyperlink Colour:</td> <td width="549"><input type="text" name="Hyperlink_Color" size="8" value="<?=$aData[Hyperlink_Color]?>" id="Hyperlink_Color" maxlength="7"> <a href="javascript: openPallete('Hyperlink_Color', 0, true)">Pick!</a></td> </tr> <tr> <td width="252">Visited Link Colour:</td> <td width="549"><input type="text" name="Visited_Link_Color" size="8" value="<?=$aData[Visited_Link_Color]?>" id="Visited_Link_Color" maxlength="7"> <a href="javascript: openPallete('Visited_Link_Color', 0, true)">Pick!</a></td> bordcolour</tr> <tr> <td width="252">Table border Colour:</td> <td width="549"><input type="text" name="bordcolour" size="8" value="<?=$aData[bordcolour]?>" id="bordcolour" maxlength="7"> <a href="javascript: openPallete('bordcolour', 0, true)">Pick!</a></td> </tr> </table> <p> <hr /> <center> <strong>Do Not Edit Below this unless you need to </strong> </center> </p> <table border="0" width="600"> <tr> <td width="252">Columns per Page:</td> <td width="549"><input type="text" name="Columns_per_Page" size="5" value="<?=$aData[Columns_per_Page]?>" maxlength="5"></td> </tr> <tr> <td width="252">Rows per Page:</td> <td width="549"><input type="text" name="Rows_per_Page" size="5" value="<?=$aData[Rows_per_Page]?>" maxlength="5"></td> </tr> <tr> <td width="252">Thumbnail Image width height:</td> <td width="549"><input type="radio" value="Width" name="Thumbnail_Image_width_height" <?=$CheckedThumbnail_Image_width_height0?>> Width <input type="radio" value="Height" name="Thumbnail_Image_width_height" <?=$CheckedThumbnail_Image_width_height1?>> Height </td> </tr> <tr> <td width="252">Thumb Size:</td> <td width="549"><input type="text" name="Thumb_Size" size="5" value="<?=$aData[Thumb_Size]?>" maxlength="7"></td> </tr> <tr> <td width="252">Space between thumbs:</td> <td width="549"><input type="text" name="Space_between_thumbs" size="5" value="<?=$aData[space_between_thumbs]?>" maxlength="7"></td> </tr> <tr> <td width="252">Display File name:</td> <td width="549"><input type="radio" value="Yes" name="Display_File_name" <?=$CheckedDisplay_File_name0?>> Yes <input type="radio" value="No" name="Display_File_name" <?=$CheckedDisplay_File_name1?>> No </td> </tr> <tr> <td width="252">Sort File:</td> <td width="549"><select size="1" name="Sort_File"> <option value="<?=$aData[sort_File]?>"><?=$aData[sort_File]?></option> <option value="Title">Title</option> <option value="Lastest">Lastest</option> <option value="Viewed">Viewed</option> </select></td> </tr> <tr> <td width="252">Show full sized image in pop up:</td> <td width="549"><input type="radio" value="Yes" name="Show_full_sized_image" <?=$CheckedShow_full_sized_image0?>> Yes <input type="radio" value="No" name="Show_full_sized_image" <?=$CheckedShow_full_sized_image1?>> No </td> </tr> <tr> <td width="252">Popup window Size:</td> <td width="549"><input type="text" name="Popup_windowx" size="3" value="<?=$WidthHeight[0]?>" maxlength="15"> x <input type="text" name="Popup_windowy" size="3" value="<?=$WidthHeight[1]?>" maxlength="15"></td> </tr> <tr> <td width="252">Footer Message:</td> <td width="549"><input type="text" name="Footer_Message" size="25" value="<?=$aData[Footer_Message]?>" maxlength="255"></td> </tr> <tr> <td width="252"> </td> <td width="549"> </td> </tr> <tr> <td width="252"> </td> <td width="549"><input type="submit" value="Save Changes" name="Are"></td> </tr> </table> </form> <? include("footer.php"); } } ?> please reply to admin@smiddies.co.uk Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.