samedi 28 février 2015

what is wrong with this code it is passing just "1" in the form handling

im making admin panel so user can edit text of the page by this helppppp please... the data on webpage is displayed through the database here im giving him option to edit data and update it this will open data in textbox and when user clicks botton update it will update data in database but problem is that when click on update the form is not passing values in the text feild it is passing value "1" i dont know from where it is getting "1" if i echo posted veriable it shows 1



<?php
$query2 = mysqli_query($con, "SELECT * FROM home");
$row = mysqli_fetch_array($query2);
$pic1 =ucfirst($row['pic1']);
$pic2 =ucfirst($row['pic2']);
$pic3 =ucfirst($row['pic3']);
$pic4=ucfirst($row['pic4']);
$pic5 =ucfirst($row['pic5']);
$pic6 =ucfirst($row['pic6']);
$pic7 =ucfirst($row['pic7']);
$pic8 =ucfirst($row['pic8']);
$par1 =ucfirst($row['par1']);
$par1pic =ucfirst($row['par1pic']);
$par2 =ucfirst($row['par2']);
$side_pic1 =ucfirst($row['side_pic1']);
$side_pic2 =ucfirst($row['side_pic2']);
?>
<form method="POST" action="update_home.php">
Paragraph no 1: <textarea name="comment" rows="5" cols="40"><?php echo $par1;?></textarea>
First name: <input type="text" name="fname"><br>
<input type="submit" name="nw_update" value="Update_1" /><br><br>
</form>
<form method="POST" action="update_home.php">
Paragraph no 2: <textarea name="comment1" rows="5" cols="40"><?php echo $par2;?></textarea>enter code here
<input type="submit" name="nw_update" value="Update_2"/><br><br>

</form>
_____________________________________________________________________________




<?php
include("dbconnection.php");
$value = isset($_POST["nw_update"]);
$fname = isset($_POST["fname"]);
echo $fname;
echo $value;
if($value=="Update_1")
{
$par = isset($_POST["comment"]);
$query2 = mysqli_query($con, "UPDATE home SET par1='$par' where id='1'");
}
if($value=="Update_2")
{
$par2 = isset($_POST["comment1"]);
$query2 = mysqli_query($con, "UPDATE home SET par2='$par2' where id='1'");


}

header("location : edit_home.php");
?>

Aucun commentaire:

Enregistrer un commentaire