I don't understand why $Nickname variable is empty when I ac
Posted: Thu Sep 01, 2011 12:28 pm
I don't understand why $Nickname variable is empty when I access for the second time:
thanks
Code: Select all
//STORE USER ANSWERS (basic and advanced)
if (strlen($_POST['UserAnswers']) > 0) {
$Nickname = $_POST["Nickname"]; //it contains the value, perfect.
$DateOfBirth = $_POST['DateOfBirth'];
$Gender = $_POST['Gender'];
$Height = $_POST['Height'];
mysql_query("UPDATE Users SET DateOfBirth = '$DateOfBirth', Gender = '$Gender', Height = '$Height'
where Nickname = '$Nickname'", $con);
// echo mysql_errno($con) . ": " . mysql_error($con) ;
//if alreadyCreated is false, give back the sentences
if ($_POST['UserAnswers'] == '0') {
$pools = explode(",", $_POST['Pools']);
//print_r($pools);
$sentences;
for($i=0;$i<count($pools);$i++) {
$result = mysql_query("SELECT * FROM Sentences WHERE Pool = '$pools[$i]'");
$randomNumber = rand(1, mysql_num_rows($result));
$counter = 1;
while ($row = mysql_fetch_assoc($result)) {
if ($randomNumber == $counter) $sentences = $sentences . $row['Sentence'].",";
$counter++;
}
$sentences = substr($sentences, 0, -1);
echo $sentences;
//store sentences in user profile
//$Nickname = $_POST["Nickname"]; I've tried this, but it is the same.. can't I just get a post argument again ?
echo 'nickname: ' . $Nickname; // this is empty, but isn't $Nickname the same variable I have set before ?