i have a problem with editing and updating my data on my database.
i cant pass or echo the data from the database into text boxes.
heres the php script.

// this script is for displaying the information oof the logged in member. and contains the link to edit the displayed info.
    $result = mysql_query("select * from info where idnum = ".$_SESSION['valid'],$conn);

    echo "</br><b>Profile Info:</b><br/>";
    echo "<center><table width='50%' top=500px left=300 border=1>";
    echo "<tr bgcolor='#CCCCCC'><td>Name</td><td>Surname</td><td>Email</td></tr>";

    while($row = mysql_fetch_assoc($result))

        $name = $row['name'];
        $surname = $row['surname'];
        $email = $row['email'];
        echo "<tr><td>$name</td><td>$surname</td><td>$email</td></tr>";

    echo "</table>";
    echo "</br>";
    echo "<td><a href=\"edit.php?idnum=$row[idnum]\">Edit Information</a>";


//this script is supposedly for retrieving the info of the logged in user into textboxes. but it doesnt quite work.
$id = $_GET['idnum'];
$result1=mysql_query("select * from info where idnum=$id",$conn);

    $name = $res['name'];
    $surname = $res['surname'];
    $email = $res['email'];
<title>Edit Data</title>

<form name="form1" method="POST" action="edit.php">
<table border="0">
        <input type="text" name="name" value=<?php echo $name;?>>    </td>
        <input type="text" name="surname" value=<?php echo $surname;?>>     </td>
        <input type="text" name="email" value=<?php echo $email;?>>     </td>
    <td><input type="hidden" name="id" value=<?php echo $_GET['idnum'];?>>    </td>
    <td><input type="submit" name="update" value="Update"></td>

instead of

value=<?php echo $name;?>> 


value=&quot;<?php echo $name;?>&quot;

as &quote allows you to use two quotation marks in the diffent languages HTML and PHP.

Also you have mots of typos like here: value=<?php echo $name;?>> toy have two > at the end.

Didnt manage to geta good looka t the code and I'm dishing up dinner but they're some tips on the go.

Antoher example:

$result = mysql_query("select * from info where idnum = ".$_SESSION['valid'],$conn);

should be:

$result = mysql_query("SELECT * FROM `info` WHERE `idnum` = '".$_SESSION['valid'],$conn."');

(Notice the last few characters...)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.