Jump to content

Archived

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

scheols

Wont Update >.<

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

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites
change

[code=php:0]$submit = $_POST['esubmit'];[/code]

to

[code=php:0]$submit = isset($_POST['esubmit']);[/code]

Share this post


Link to post
Share on other sites
@ seocnd poster

yep that did it can u tell me what u changed? opps nvm i know :)

Share this post


Link to post
Share on other sites
Oh... hehe should have seen that.  if($_POST['esubmit']) just checks if it has a value... isset checks if it has a value and isnt ""

Share this post


Link to post
Share on other sites

×

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.