Cant update table in using isset

Posted by Ali Munandar on Stack Overflow See other posts from Stack Overflow or by Ali Munandar
Published on 2013-10-30T03:51:49Z Indexed on 2013/10/30 3:53 UTC
Read the original article Hit count: 135

Filed under:
|

I have a table called settings, when I would change or enter data into the form it did not change the data in the table. In addition on form an image upload file is not running, There may be the wrong code below.

<div class="maintitle">Site Settings</div>
<?php
$act=isset($_GET['act'])?$_GET['act']:"";

if($act=='sub'){
$name=isset($_POST['site'])?$_POST['site']:"";
$keys=isset($_POST['keywords'])?$_POST['keywords']:"";
$desc=isset($_POST['descrp'])?$_POST['descrp']:"";
$email=isset($_POST['email'])?$_POST['email']:"";
$fbpage=isset($_POST['fbpage'])?$_POST['fbpage']:"";
$twitter=isset($_POST['twitter'])?$_POST['twitter']:"";
$gplus=isset($_POST['gplus'])?$_POST['gplus']:"";
$disclaimer=isset($_POST['disclaimer'])?$_POST['disclaimer']:"";
$template=isset($_POST['template'])?$_POST['template']:"";


mysql_query("UPDATE settings SET site='$name',keywords='$keys',descrp='$desc',email='$email',fbpage='$fbpage',twitter='$twitter',gplus='$gplus',disclaimer='$disclaimer',template='$template' WHERE id=1");

if($_FILES["file"]["name"]!=''){
           move_uploaded_file($_FILES["file"]["tmp_name"], "../images/logo.png");
    }?>

<div class="infomsgbox">Settings updated successfully.</div>  

<?php }

$q=mysql_query("select * from settings where id=1");
$s=mysql_fetch_assoc($q);
?>
<div class="box">
<div class="inbox">
<!--form-->
<form action="index.php?act=sub" method="post" enctype="multipart/form-data">
<label class="artlbl">Site Name</label>
<div class="formdiv">
<input type="text" name='site' value='<?php echo $s['name']?>'/>
</div>
<label class="artlbl">Logo (264px x 85px)</label>
<div class="formdiv">
<input type='file' class="file" name='file'/>
</div>
<div class="clear"></div>
<label class="artlbl">Meta Keywords (Separated by Commas)</label>
<div class="formdiv">
<textarea name='keywords' cols=40 rows=5 ><?php echo $s['keywords']?></textarea>
</div>
<label class="artlbl">Meta Description</label>
<div class="formdiv">
<textarea name='descrp' cols=40 rows=5 ><?php echo $s['descrp']?></textarea>
</div>

<label class="artlbl">Email</label>
<div class="formdiv">
<input type="text" name='email' value='<?php echo $s['email']?>'/>
</div>

<label class="artlbl">Facebook Fan Page</label>
<div class="formdiv">
<input type="text" name='fbpage' value='<?php echo $s['fbpage']?>'/>
</div>

<label class="artlbl">Twitter URL</label>
<div class="formdiv">
<input type="text" name='twitter' value='<?php echo $s['twitter']?>'/>
</div>

<label class="artlbl">Google+ URL</label>
<div class="formdiv">
<input type="text" name='gplus' value='<?php echo $s['gplus']?>'/>
</div>

<label class="artlbl">Site Disclaimer</label>
<div class="formdiv">
<textarea name='disclaimer' cols=40 rows=5 ><?php echo $s['disclaimer']?></textarea>
</div>

<label class="artlbl">Template</label>
<div class="formdiv">
<select name="template" id="template">
<option value="<?php echo $s['template'];?>"><?php echo ucfirst($s['template']);?></option>
<?php
foreach(glob('../templates/*', GLOB_ONLYDIR) as $dir) {
    $TemplateDir = substr($dir, 13);
    $TemplateName = ucfirst($TemplateDir)
?>
<option value="<?php echo $TemplateDir;?>"><?php echo $TemplateName;?></option>
<?php }?>
</select>
</div>
<div class="clear"></div>

</br>
<div class="formdiv">
<div class="sbutton"><input type="submit" id="submit" value="Update Site Settings"/></div>
</div>
</form>
</div>
</div><!--box-->

Maybe someone can help me Related to this.

© Stack Overflow or respective owner

Related posts about post

Related posts about isset