Jump to content

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]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.