I'm not sure what to title this actually
I have a registration form that collects a merchant_code from the refering URL
(www.bobssite.com?merchant_code=5001) as well as the information entered
by the visitor.
If I have a merchant_code of 5001 I want to insert a value of Bob into the level
field of my table. If merchant_code is 5002 I want Joe inserted into the level
field. To find these equalities I use the following:
<?PHP $level = mysql_query("SELECT level FROM merchants
WHERE merchant_code = '$merchant_code'",$db);
if ($myrow = mysql_fetch_array($level)) {
echo "
<table border=0>
<td>\n";
echo "<tr>
<td>\n";
do {
printf("</font><tr>
<td>%s</td>
</tr>
<td>\n", $myrow["level"]);
} while ($myrow = mysql_fetch_array($level));
echo "</font></table></center>
\n";
} else {
echo "<center>Sorry, no records were found!</center>";
}
?>
This returns 'Bob' if code is 5001 and Joe if 5002.
Now what I want to do is insert the name "Bob" or "Joe" into the field "level" in
the table. This is currently the only way I know how to get info from a db. Thing is, I don't
know how to make this into a variable that can then be inserted back into a
different field.
I've tried using $level but nothing shows up. If I use echo $level I get 'resource ID #2 or sometimes #3.
I want this to be inserted with the other info that the visitor has entered.
$sql = "INSERT INTO xcart_customers
(firstname,lastname,email,password,login,usertype,referer,membership)
VALUES ('$firstname','$lastname','$email','$password1','$login','$usertype','$referer','$level')";
I'm hoping there's an easy way to do this 'cause I'm starting to think I'm over my head here.
Thanks for any help,
Scurvy