View Single Post
ישן 14-09-06, 15:53   # 2
Elad-A
הוסטסניון
 
מיני פרופיל
תאריך הצטרפות: May 2006
הודעות: 1,987

Elad-A לא מחובר  

תנסה אולי ככה:

PHP קוד:

<html dir="rtl"> 

<?php  
include("db.php");  
    
$id    =    $_GET['id'];  
    function 
edit($id)  
    {  
        
$query    =    mysql_query("SELECT * FROM `text` WHERE `id`='$id'");  
        
$result    =    mysql_fetch_array($query);  
        
$id    =    $result['id'];  
        
$img    =    $result['img'];  
        
$title    =    $result['title'];  
        
$content    =    $result['content'];  
        echo 
"  
        <form action='update.php' method='post'>  
        <p align='right'>  
        תמונה :  
        <input type='text' name='img' value='$img' size='23'><br> 
        כותרת :  
        <input type='text' name='title' value='$title' size='23'><br> 
        מספר אידי :  
        <input type='hidden' name='id' value=$id size='23'><br> 
        תוכן ההודעה :  
        <textarea name='content' rows='8' cols='31'>$content</textarea>  
        </p> 
        <br><input type='submit' value='עדכן'><br></form>"
;  
}  
        
edit($id);  
?> 
<p align="right">&nbsp;</p>

update.php

PHP קוד:

<? 
require "db.php";      

$id1 $_POST['id']; 
$img1 $_POST['img']; 
$title1 $_POST['title']; 
$content1 $_POST['contnet']; 
    
$resultID mysql_query("UPDATE text SET id = '$id1', img = '$img1', title = '$title1', content = '$content1' WHERE id = '$id'") or die(mysql_error()); 
    if (
$resultID == TRUE
{
        print 
"נערך בהצלחה!"
echo 
" <script language=\"JavaScript\">window.location=(\"view.php\");</script> ";
}

?>

Last edited by Elad-A; 14-09-06 at 16:00..
  Reply With Quote