View Single Post
ישן 18-01-09, 22:48   # 4
Erez | TrustMedia.co.il
עסק רשום [?]
 
מיני פרופיל
תאריך הצטרפות: Jul 2008
הודעות: 1,854

Erez | TrustMedia.co.il לא מחובר  

PHP קוד:
if ($_GET['id']) {
  
$id $_GET['id'];
$query "SELECT * FROM table WHERE id='$id'";
$result mysql_query($query)
    or die(
"Query failed: " mysql_error());
while (
$row mysql_fetch_array($result)) {
$id $row['id'];
$title $row['title'];
$news $row['news'];
  echo 
"<form action='?id=update&$id' method='post'>";
  echo 
"<input type='text' name='title' size='70' maxlength='50' value=\"$title\"> &nbsp; <input type='submit' name='button' value='שלח'>
        <br /><textarea rows='10' cols='100' name='news' onPaste='return checkArea(this)' onKeyPress='return checkArea(this)' onKeyUp='totalChars.innerText=this.value.length'>$news</textarea>
<br />
<span id=totalChars>0</span> מתוך 500 תווים"
;
  echo 
"</form>";
}
}

else if (
$_GET['id'] == "update&$id") {
$title $_POST['title'];
$news $_POST['news'];
$title htmlspecialchars($title);
$news htmlspecialchars($news);
$query "UPDATE table SET title='$title' , news='$news' WHERE id='$id'";
$result mysql_query($query)
    or die(
"Query failed: ".mysql_error());
echo 
"<meta http-equiv=\"refresh\" content=\"0;url='$url'\" />";

__________________
  Reply With Quote