Jump to content


Photo

Edit Script doesnt work got any suggestions how 2 edit/fix problem -_-


  • Please log in to reply
3 replies to this topic

#1 scheols

scheols
  • Members
  • PipPipPip
  • Advanced Member
  • 113 posts

Posted 27 July 2006 - 02:57 AM

http://shout.xizionz...t.com/shout.php <preview

Edit script:

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

$query1 = "SELECT * FROM shouts WHERE zid='$id' ";
$query2 = mysql_query($query1);

while($row = mysql_fetch_array($query2)){
echo "<input type='text' name='ename\' value='<? echo $row[name] ?>'><br>";
echo "<textarea name=\'epost\'><? echo $row[post] ?> </textarea><br>";
echo "<input type=\'submit\' name=\'esubmit\'>";
$ename = $_POST['ename'];
$epost = $_POST['epost'];
$esubmit = $_POST['esubmit'];
if(isset($esubmit)){
mysql_query("UPDATE shouts SET post='$epost', name='$ename' WHERE zid=$id");
echo"Edit Successfully";
}}
?>

Post script:
<?php
include "database.php";

$name = htmlspecialchars($_POST['name']);
$post = htmlspecialchars($_POST['post']);
$submit = $_POST['submit'];
if(isset($submit)){
if($name|$post == ""){
exit();
}else{

mysql_query("INSERT INTO shouts (name,post) VALUES('$name','$post')") or die(mysql_error());
echo "Post made Successfully";
}}
?>

shoutpage:

<form method="post" action="posts.php">
Name:<input type="text" name="name"><br>
Post:<textarea name="post"></textarea><br>
<input type="submit" name="submit"></br>
</form>

<?php
include "database.php";
$result = mysql_query("SELECT * FROM shouts");
while($row = mysql_fetch_array($result)){
echo "<b>".$row['name']."</b>";
echo "<br>".$row['post'];
echo "<br><form action=\"edit.php\"><input type=\"submit\" name='edit' value='edit'></form>";
echo "<br>-------------------------------------------------<br>";
}

?>

Dont Piss me Off today

#2 corbin

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

Posted 27 July 2006 - 04:43 AM

whats setting
$ename = $_POST['ename'];
$epost = $_POST['epost'];
$esubmit = $_POST['esubmit'];
?
Why doesn't anyone ever say hi, hey, or whad up world?

#3 scheols

scheols
  • Members
  • PipPipPip
  • Advanced Member
  • 113 posts

Posted 27 July 2006 - 04:47 AM

mod can close this because i errased this script and started a new one and im about 90% done.
Dont Piss me Off today

#4 vinny_bc

vinny_bc
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 27 July 2006 - 04:49 AM

Syntax error that jumps out at me is at this line

if($name|$post == ""){

Try changing it to

if($name == "" || $post == ""){

does that help?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users