Jump to content


Photo

Wont Update >.<


  • Please log in to reply
4 replies to this topic

#1 scheols

scheols
  • Members
  • PipPipPip
  • Advanced Member
  • 113 posts

Posted 27 July 2006 - 04:42 AM

<?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>
<?
}
}
?>

anyone have and idea

http://shout.xizionz...t.com/shout.php
Dont Piss me Off today

#2 corbin

corbin
  • Staff Alumni
  • Advanced Member
  • 8,129 posts

Posted 27 July 2006 - 04:49 AM

Try:
<?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>
<?
}
}
?>

Why doesn't anyone ever say hi, hey, or whad up world?

#3 vinny_bc

vinny_bc
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 27 July 2006 - 04:50 AM

change

$submit = $_POST['esubmit'];

to

$submit = isset($_POST['esubmit']);


#4 scheols

scheols
  • Members
  • PipPipPip
  • Advanced Member
  • 113 posts

Posted 27 July 2006 - 04:52 AM

@ seocnd poster

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

#5 corbin

corbin
  • Staff Alumni
  • Advanced Member
  • 8,129 posts

Posted 27 July 2006 - 04:55 AM

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 ""
Why doesn't anyone ever say hi, hey, or whad up world?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users