hello every body i have one error in this code i don't know what us the error ++ sorry my english is sp bad <?php $query=mysql_query("SELECT * FROM setting") or die(mysql_error()); $row=mysql_fetch_object($query); $name=$_POST['site_name']; $url=$_POST['site_url']; $mail=$_POST['site_mail']; $desc=$_POST['site_desc']; $tags=$_POST['site_tags']; $close=$_POST['site_close']; $tclose=$_POST['site_tclose']; if(isset($_POST['do']) &&$_POST['do']=='save'){ $up=mysql_query("update setting set site_name='$name', site_url='$url', site_email='$mail', site_desc='$desc', site_tags='$tags', site_close='$close', site_tclose='$tclose', ") or die(mysql_error()); if(isset($up)){ echo ' تم Ø¨Ù†Ø¬Ø§Ø <meta http-equiv="refresh" content="2; url=?cpages=m_setting" />'; } } echo " <head> <link rel='stylesheet' type='text/css' href='styles/admincp.css' /> </head> <div class='head'>اعدادات عامة</div> <div class='bodypanel'> <form action='?cpages=m_setting' method='post'> <table align='center' cellpadding='0' cellspacing='0'> <td valign='top' class='rpanel' width='20%'> <tr> <td class='font'>اسم الموقع</td> <td><input type='text' name='site_name' value='".$row->site_name."' /></td> </tr> <tr> <td class='font'>رابط الموقع</td> <td><input type='text' name='site_url' value='".$row->site_url."' /></td> </tr> <tr> <td class='font'>بريد الموقع</td> <td><input type='text' name='site_email' value='".$row->site_email."' /></td> </tr> <tr> <td class='font'>وص٠الموقع</td> <td><textarea name='site_desc' cols='40' rows='5'>".$row->site_desc."</textarea></td> </tr> <tr> <td class='font'>الكلمات الدليلية</td> <td><textarea name='site_tags' cols='40' rows='5'>".$row->site_tags."</textarea></td> </tr> <tr> <td class='font'>ØØ§Ù„Ø© الموقع</td> <td><select name='site_close'> "; if ($row->site_close==1){ echo "<option value='1'>Ù…ÙØªÙˆØ للزوار</option> <option value='2'>مغلق للزآر</option>"; } else{ echo "<option value='2'>مغلق للزوار</option> <option value='1'>Ù…ÙØªÙˆØ للزوار</option>"; } echo " </select>/<td> </tr> <tr> <td class='font'>رسآلة الاغلآق</td> <td><textarea name='site_tags' cols='40' rows='5'>".$row->site_tclose."</textarea></td> </tr> <tr> <td><input class='sub' type='submit' name='ارسل' /></td> <input type='hidden' value='do' value='save' /> </tr> </table> </div> </form>"; ?> PHP: sql CREATE TABLE `setting` ( `site_name` VARCHAR( 250 ) NOT NULL , `site_url` VARCHAR( 250 ) NOT NULL , `site_mail` VARCHAR( 250 ) NOT NULL , `site_desc` TEXT NOT NULL , `site_tags` TEXT NOT NULL , `site_close` VARCHAR( 2 ) NOT NULL , `site_tclose` TEXT NOT NULL ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci Code (markup):
Agreed. Also if(isset($_POST['do']) &&$_POST['do']=='save') The bold part is unnecessary. $_POST['do'] must be set to have a value 'save' Another thing $query=mysql_query("SELECT * FROM setting") or die(mysql_error()); $row=mysql_fetch_object($query); PHP: Should be after the if( $_POST['do'] == 'save' ) { ............ }, just before the echo " <head>... " Your logic is out of order so after you post the form you will still see old content until you refresh the page once again.