Am having a devil of a time inserting data into database. No, this is not the straight forward use of form data as input to an INSERT statement. Here’s the set-up:
-
user provides data to be checked against a master database:
<TABLE CLASS="inputMatchTableBorder" WIDTH=275 ALIGN=CENTER> <form action="index.php" method="post"> <tr> <td width=30% align=right>First Name </td> <td width=70%><input type="text" name="firstName" size="25"></td> </tr> <tr> <td width=30% align=right>Last Name </td> <td width=70%><input type="text" name="lastName" size="25"></td> </tr> <tr> <td width=30% align=right>Email </td> <td width=70%><input type="text" name="eMail" size="25"></td> </tr> <tr><td colspan=2 align=center><input type="submit" name="submit" value="Confirm"></td></tr> </form> </TABLE>
-
form data (user input) is used as input to a QUERY of the database to determine if user has an account:
$query_Membership = "SELECT * FROM Membership WHERE (firstName) = ('$lowercase_firstName') AND (lastName) = ('$lowercase_lastName')"; $result = @mysql_query($query_Membership); $details = mysql_fetch_array($result);
-
This is the problem area! How do I take the information retrieved from the database, display it for the user (to see and manually verify the accuracy of the first & last names and/or email address) and use the DISPLAYED DATA as INPUT for an INSERT into a different database?
Create "Members Only" access? | ||
---|---|---|
First Name | <? if ($details['firstName'] <> ''){?><?echo (" " . $details['firstName'] . "");?> | <?} else {?><?}?> |
Last Name | <? if ($details['lastName'] <> ''){?><?echo (" " . $details['lastName'] . "");?> | <?} else {?><?}?> |
<?echo (" " . $details['eMail'] . "");?> | <?} else {?><?}?> | |
Username | <? $user = substr(($details['firstName']), 0, 1); $name = substr(($details['lastName']), 0); $username = $user . $name; echo (" " . $username . "");?> | |
not_a_bozo sez: Much thanks for your help with this!
(I hope this qualifies for a PHP-related question. I have a hard time determining when I am using PHP and MySQL statements. I guess this qualifies me as a Beginner and thus the use of this “Beginners” forum.)