scheols Posted July 27, 2006 Share Posted July 27, 2006 http://shout.xizionz.vectoredhost.com/shout.php <previewEdit script:[code=php:0]<?phpinclude "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";}}?>[/code]Post script:[code=php:0]<?phpinclude "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";}}?>[/code]shoutpage:[code=php:0]<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><?phpinclude "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>";}?>[/code] Link to comment https://forums.phpfreaks.com/topic/15769-edit-script-doesnt-work-got-any-suggestions-how-2-editfix-problem-_/ Share on other sites More sharing options...
corbin Posted July 27, 2006 Share Posted July 27, 2006 whats setting$ename = $_POST['ename'];$epost = $_POST['epost'];$esubmit = $_POST['esubmit'];? Link to comment https://forums.phpfreaks.com/topic/15769-edit-script-doesnt-work-got-any-suggestions-how-2-editfix-problem-_/#findComment-64501 Share on other sites More sharing options...
scheols Posted July 27, 2006 Author Share Posted July 27, 2006 mod can close this because i errased this script and started a new one and im about 90% done. Link to comment https://forums.phpfreaks.com/topic/15769-edit-script-doesnt-work-got-any-suggestions-how-2-editfix-problem-_/#findComment-64502 Share on other sites More sharing options...
vinny_bc Posted July 27, 2006 Share Posted July 27, 2006 Syntax error that jumps out at me is at this line[code=php:0]if($name|$post == ""){[/code]Try changing it to[code=php:0]if($name == "" || $post == ""){[/code]does that help? Link to comment https://forums.phpfreaks.com/topic/15769-edit-script-doesnt-work-got-any-suggestions-how-2-editfix-problem-_/#findComment-64503 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.