Many hanks for ya'lls help earlier.

I've figured out how to pull the data and edit it:
http://www.hedges.org/aoii/olemiss/updatesister.php

However, for some reason I can't get it to edit whatever row.  In the code
(pasted below) I have to specificy $id=row to edit...

I can't figure out how to make it to where the user can select the field
(which is the id/row) and edit it.  I've tried putting a ?id=# at the end of
the url, but that doesn't work...  Any thoughts?  So what I want is where it
says

$id=1

to have it someway where that is a variable that the user can define...



<html>
<head><title>Update Sister Info.</title></head>
<body>
<?php
  $host="host";
  $user="user";
  $password="pw";
  $database="db";
  $id=1;
  $connection = mysql_connect($host,$user,$password)
       or die ("couldn't connect to server");
  $db = mysql_select_db($database,$connection)
       or die ("Couldn't select database");

  if (@$first == "no")
  {

        $query = "UPDATE table SET
FirstName='$FirstName',MiddleName='$MiddleName',LastName='$LastName',GradYea
r='$GradYear',Email='$Email',MarriedName='$MarriedName' WHERE id='$id'";
        $result = mysql_query($query)
             or die ("Couldn't execute query.");
        echo "Thank you! Information entered. <a href=actives.php>View
Actives</a><br>";
        exit();

  }
  else
  {
    $query = "SELECT * FROM table WHERE id='$id'";
    $result = mysql_query($query)
         or die ("Couldn't execute query.");
    $row = mysql_fetch_array($result);
    extract($row);
  }

  /* Display user phone in a form */
  echo "<br><p align='center'>
       <font size='+1'><b>Please check the sister below and correct if
necessary.</b></font>
       <hr>
       <form action='updatesister.php?first=no' method='post'>
        <div align='center'>
        <table width='50%' border='0' cellspacing='0' cellpadding='2'>
        <tr><td align='right'><B>$id</br></td>
           <td align='center'><input type='text' name='FirstName' size='20'
maxlength='20' value='$FirstName' > </td>
           <td align='center'><input type='text' name='MiddleName' size='20'
maxlength='20' value='$MiddleName' > </td>
           <td align='center'><input type='text' name='LastName' size='20'
maxlength='20' value='$LastName' > </td>
           <td align='center'><input type='text' name='GradYear' size='20'
maxlength='20' value='$GradYear' > </td>
           <td align='center'><input type='text' name='Email' size='20'
maxlength='20' value='$Email' > </td>
           <td align='center'><input type='text' name='MarriedName'
size='20' maxlength='20' value='$MarriedName' > </td>

        </tr>
        <tr><td></td><td align='center'>
           <br><input type='submit' value='Update Sister'></td>
        </tr>
        </table>
       </form>";
?>
</body>
</html>



Thank you.
Matt



-- 
___________________________
| Matt Hedges
| http://hedgesinnovations.com
|



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to