Jump to content

cjacks

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cjacks's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am totally new to PHP. I have tried in vein to understand how it works. I am so frustrated. I know how to make a database and a table. I know how to make a form that will in put data into the table. I know how I can make a record set that an "admin" can view and update each record by selecting the record to update (sending a $id via the URL line to the script as the record to update. But for the life of me I can not figure out how to write a form/script that would allow a single user to log on and update thier specific record. Please I need help with this. I have tried for countless days to get this to work with no success. My bigest problem is the update form. Not an admin type form that an admin can update any record from, but a single user form that only that user can update (except the admin) of course. As I understand it, this is best acomplished with sessions. Any small script examples to this would be a great help!! Register/Login/View Account/Update Account Please help this is driving me crazy!
  2. I am having trouble getting this script to work. I need it to retrieve a mysql record in to a form to allow users to update thier information. The update would be based on email and password entered on a diffrerent form, query sent to database, current results retrieved in to form that the user sees and can update from there. Any help on this greatly appreciated. I am sure it is basic for most of you, but I am not good with php at all. Thanks! <?php include("include/dbconnect.php"); $email = $_POST['email']; $pword = $_POST['pword'] ; if ( $email && $pword ) { $result = mysql_query("SELECT * FROM $table WHERE email=$email",$db); $myrow = mysql_fetch_array($result); ?> <form method="post" action="update.php"> <table width="380" border="0" cellspacing="1" cellpadding="1"> <tr> <td> <input type="hidden" name="email" value="<?php echo $myrow["email"]?>"> Firstname:</td> <td> <input type="Text" name="firstname" size="35" value="<?php echo $myrow["firstname"]?>"> </td> </tr> <tr> <td>Lastname:</td> <td> <input type="Text" name="lastname" size="35" value="<?php echo $myrow["lastname"]?>"> </td> </tr> <tr> <td>Street:</td> <td> <input name="street" type="text" value="<?php echo $myrow["street"]?>" size="35"> </td> </tr> <tr> <td>City:</td> <td> <input name="city" type="Text" id="city" value="<?php echo $myrow["city"]?>"> </td> </tr> <tr> <td>State:</td> <td> <input name="state" type="Text" id="state" value="<?php echo $myrow["state"]?>"> </td> </tr> <tr> <td>Zip:</td> <td> <input name="zip" type="Text" id="zip" value="<?php echo $myrow["zip"]?>"> </td> </tr> <tr> <td>Telephone:</td> <td><input name="home" type="text" id="home" value="<?php echo $myrow["home"]?>"></td> </tr> <tr> <td>Email:</td> <td> <input type="Text" name="email" size="35" value="<?php echo $myrow["email"]?>"> </td> </tr> <tr> <td>Password</td> <td> <input type="Text" name="pword" size="35" value="<?php echo $myrow["pword"]?>"> </td> </tr> <tr> <td>Birthday (Day/Month/Year)</td> <td> <input name="bday" type="text" id="bday" value="<?php echo $myrow["bday"]?>" size="2" maxlength="2"> / <input name="bmonth" type="text" id="bmonth" value="<?php echo $myrow["bmonth"]?>" size="2" maxlength="2"> / <input name="byear" type="text" id="byear" value="<?php echo $myrow["byear"]?>" size="4" maxlength="4"> </td> </tr> </table> <input type="Submit" name="update" value="Update information"> </form> <? $sql = "UPDATE $table SET firstname='$firstname',lastname='$lastname',street='$street',city='$city',state='$state',zip='$zip',email='$email',home='$home',bday='$bday',bmonth='$bmonth',byear='$byear',pword='$pword' WHERE email=$email"; $result = mysql_query($sql); echo "<br><br>Address book updated.\n"; } elseif ($update); { ?> <form method="post" action="<?php echo $PHP_SELF?>"> <table width="380" border="0" cellspacing="1" cellpadding="1"> <tr> <td> Email:</td> <td> <input name="email" type="Text" id="email" size="35"> </td> </tr> <tr> <td>Passsword:</td> <td> <input name="pword" type="Text" id="pword" size="35"> </td> </tr> </table> <input type="Submit" name="submit" value="Enter information"> </form> <? } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.