Jump to content

Archived

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

scheols

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

Recommended Posts

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

Edit script:

[code=php:0]<?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";
}}
?>[/code]

Post script:
[code=php:0]<?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";
}}
?>[/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>

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

?>[/code]

Share this post


Link to post
Share on other sites
whats setting
$ename = $_POST['ename'];
$epost = $_POST['epost'];
$esubmit = $_POST['esubmit'];
?

Share this post


Link to post
Share on other sites
mod can close this because i errased this script and started a new one and im about 90% done.

Share this post


Link to post
Share on other sites
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?

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.