Jump to content

Wont Update >.<


scheols

Recommended Posts

[code]
<?php
include "database.php";
$zid = $_GET['id'];
$submit = $_POST['esubmit'];

if($submit){
$ename = $_POST['ename'];
$epost = $_POST['epost'];

$result = mysql_query("UPDATE shouts SET post=$epost, name=$ename WHERE zid=$zid ");
echo "Thank You Your News Has Been Edited SuccessfullyYou Will Now Be Redirected <meta http-equiv=Refresh content=4;url=shout.php>";
}
elseif($zid){

$result = mysql_query("SELECT * FROM shouts WHERE zid='$zid' ");
while($row = mysql_fetch_array($result)){

$name = $row['name'];
$post = $row['post'];
?>

<h2>::Edit News::</h2>

<form method="post" action="<?php echo $PHP_SELF ?>">
<input type="hidden" name="zid" value="<? echo $row['zid'] ?>">
Name: <input type="text" name="ename" maxlength="20" value="<? echo $name; ?>"><br>
Post:<textarea name="epost"><? echo $post; ?></textarea>
<input type="submit" name="esubmit" value="Update Post">
</form>
<?
}
}
?>
[/code]

anyone have and idea

http://shout.xizionz.vectoredhost.com/shout.php
Link to comment
https://forums.phpfreaks.com/topic/15779-wont-update/
Share on other sites

Try:
[code]<?php
include "database.php";
$zid = $_GET['id'];
$submit = $_POST['esubmit'];
$p_zid = $_POST['zid'];

if($submit){
$ename = $_POST['ename'];
$epost = $_POST['epost'];

$result = mysql_query("UPDATE `shouts` SET `post` = '$epost', `name` = '$ename' WHERE `zid` = '$p_zid' ");
echo "Thank You Your News Has Been Edited SuccessfullyYou Will Now Be Redirected <meta http-equiv=Refresh content=4;url=shout.php>";
}
elseif($zid){

$result = mysql_query("SELECT * FROM shouts WHERE zid='$zid' ");
while($row = mysql_fetch_array($result)){

$name = $row['name'];
$post = $row['post'];
?>

<h2>::Edit News::</h2>

<form method="post" action="<?php echo $PHP_SELF ?>">
<input type="hidden" name="zid" value="<? echo $zid; ?>">
Name: <input type="text" name="ename" maxlength="20" value="<? echo $name; ?>"><br>
Post:<textarea name="epost"><? echo $post; ?></textarea>
<input type="submit" name="esubmit" value="Update Post">
</form>
<?
}
}
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/15779-wont-update/#findComment-64504
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.