[Wolves] yet another php/mysql question

Wayne Morris waynelists at machx.co.uk
Fri Apr 13 22:33:47 UTC 2012


been banging on at this simple thing for about 6 hours and can't get it!
Sorry its not 'Linux' , but its a bit quiet in here of late so i might 
as well ;-)

Got two scripts
update.php - displays current record and allows you to change info -
sends to
record.php - sticks it in the database

and another pair insert and save which create new records.

been using them succesfully so I can send someone a link containing

../update.php?id=43&name=bob

and it will pull up bob's record and allow edit and save.

All well and good, but I wanted to create an on the fly link during the 
insert phase but of course at that point you don't know the ID until 
record created so decided to use
email and dob as unique items.

1) or can you get id during the insert/save as a emailable variable - 
that's probably the easiest cos then other scripts untouched.?

2) what i have been mostly attempting to do is create a hyperlink 
containing email address and dob during insert phase eg
../update.php?email=xxx&dob=yyyy  so changed id to email ,  update.php 
receives this post data, opens the right record , got it set to display 
the correct ID.
so id is set as $id - so update.php is populated with all the info 
needed as when using id and dob to populate.

Can I get the bugger to save the record to that ID can I hell?
The ID seems to be present as it appears in update.php, do I need to do 
anything special to get it posted to record.php?

the bits that seem to matter:

update.php
echo "<form method=\"POST\" action=\"updaterecordtest.php\">";
echo " <tr>";
echo " <td width=\"35%\">Diver ID</td>";
echo " <td width=\"65%\"><input type=\"text\" name=\"id\" size=\"35\" 
value=\"".$row["id"]."\"></td>";

(shows correct ID)

  record.php are:
$id = $_POST["id"];

and
    if (isset($id))
   {
          $query = "UPDATE phonelist SET
                                  coname = '$coname',
                      address1 = '$address1' ,
                     etc

                          WHERE
                                  id = '$id'
          ";

etc

(nothing recorded)

help!!

cheers










More information about the Wolves mailing list