Just wondered if anyone could help me, what am i doing wrong here im trying to cant seem to get $email, $betakey or $userid to show any data i know im missing something but for teh life of me cant think tried everything i could think of fetch etc but to no avail please help

<?
session_start();
include "includes/db_connect.php";
 
 
$accepted=$_POST['accepted'];
{
mysql_query("UPDATE users SET accepted='yes' WHERE username='$accepted'");
mysql_query("SELECT * FROM users WHERE username='$accepted' AND betakey='$betakey' AND id='$userid' AND email='$email'");
 
$sendto = "$email"; 
$subject = "You've Been Accepted";
$message = "Congratulations $accepted, You have been selected to beta test GAME NAME.
Click To Activate Your Beta Account: http://www.gameurl.com/betaactivate.php?id=$userid&code=$betakey
 
Beta Information:
Username: $accepted
Beta Key: $betakey
Hope You Enjoy
GAME NAME Staff.
This is an automated response, please do not reply!";
mail($sendto, $subject, $message,
"From: GAME NAME<admin@gamename.com>");
print "You made $accepted a beta tester ";
}
?>

and the email i recieve (when i add my own email addy in $sendto) looks like this:

Congratulations testbeta, You have been selected to beta test GAME NAME.

Click To Activate Your Beta Account: http://www.gameurl.com/betaactivate.php?id=&code=


Beta Information:
Username: testbeta
Beta Key:

Hope You Enjoy
GAME NAME Staff.

This is an automated response, please do not reply!

Recommended Answers

All 6 Replies

You used the variables but never assigned any value to them before you used them. Are they supposed to get their values from a previous form? If so, you have to assign it to them before you use them.

basicaly i want ppl to sign up for beta testing and then i want to be able to accept ppl individualy so the first part works fine it adds there email,userid and username to the database and also adds a random number to the betakey field and then sends me an email saying username has requested to be a beta tester that works all fine, then i go into my admin panel and select ppl from my email ie username qwerty wants to be a beta tester so i add qwerty in the form click submit now what i want to do is send qwerty an email (using the email already in the database) containing his/ her username their userid and there unique beta registration key. hope that makes sense :)

Yes, but what I was saying is that based from your script you are trying to use variables for which their variables have not been set, meaning they have null or empty values. Now, judging from your script you can try changing:

[B]mysql_query([/B]"SELECT * FROM users WHERE username='$accepted' AND betakey='$betakey' AND id='$userid' AND email='$email'"[B])[/B];

to:

$result = [B]mysql_query([/B]"SELECT * FROM users WHERE username='$accepted'"[B])[/B];
 
$record = mysql_fetch_array($result, MYSQL_ASSOC);
if (!empty($record))
{
$betakey = $record['betakey'];
$userid = $record['userid'];
$email = $record['email'];
}
else
{
// Insert error handler/User notification that sending of email has failed
}

Try it out and let me know if it still doesn't work

it worked nice one thanks :)

ur welcome! glad to be of assistance :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.