
September 3rd, 2002, 08:11 PM
|
|
|
|
Join Date: Apr 2007
Location: London, UK
Posts: 129
Time spent in forums: < 1 sec
Reputation Power: 2
|
|
|
crazy edit thingy
my code is coming out crazy at the mo, I know the code isn't complete yet, I'm just building it up and debugging it as I go along, but on the edit tutorial, I found that when it comes to the actually editing, it formats all wrong, well you have to see what I mean here http://gmflp.l33t.ca/yepyep/news.php?action=edit&id=4 I dunno whats thats all about, please help
php Code:
Original
- php Code |
|
|
|
<?php if (!$db) { echo( "<p>Unable to connect to the " . "database server at this time.</p>" ); } echo( "<p>Unable to locate the news " . "database at this time.</p>" ); } if($submit) { $sql = "INSERT INTO newsdb (name, email, title, news, date) VALUES ('$name', '$email', '$title','$news', now('$date'))"; echo( "Thank you! Information entered. Click <a href=/news.php>here</a> to view your news" ); } elseif($_GET['action'] == 'edit') { $result = mysql_query("SELECT * FROM newsdb WHERE id=$id", $db); echo "<form method=post action=". $PHP_SELF. ">"; echo "<input type=hidden name=id value=". $myrow['id']. ">"; echo "<b>Title</b>: <input type=Text name=title value=". $myrow['title']. "><br>"; echo "<b>News:</b> <textarea name=news cols=40 rows=8 value=". $myrow['news']. "><br>"; echo "<b>Name:</b><input type=Text name=name value=". $myrow['name']. "><br>"; echo "<b>E-mail:</b><input type=Text name=email value=". $myrow['email']. "><br>"; echo "<input type=Submit name=update value=Update information></form>"; } elseif($searchstring) { $sql="SELECT * FROM newsdb WHERE title LIKE '%$searchstring%' ORDER BY title ASC"; echo("<b>Title:</b> ". $myrow['title']. "<br><b>News:</b> ". $myrow['news']. "<br><a href=?action=edit&id=". $myrow['id']. ">Edit</a> | <a href=?action=delete&id=". $myrow['id']. ">Delete</a><p>"); } else { ?> <form method="post" action="<?=$PHP_SELF?>"> Name: <br><input type="Text" name="name"> <br>Email: <br><input type="Text" name="email"> <br>Title: <br><input type="Text" name="title"> <br>News: <br><textarea name="news" cols=40 rows=8></textarea> <br> <input type="Submit" name="submit" value="Submit"></form> <h3>MADE AN ERROR? EDIT IT HERE</H3> <form method="POST" action="<?php $PHP_SELF ?>"> Enter the title of the news:<input type="text" name="searchstring" size="28"> <br><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"> </form> <? } ?>
|