this following php code is not editing my database, no errors show up and nothing is echoed after clicked:
class functions {
public static function chooseGiftee($SS){
$done = false;
$sqllink= mysql_connect($mysql_host,$mysql_user,$mysql_password);
if(!$sqllink){
echo "Could not connect! Please Try Again";
mysql_close($sqllink);
} else {
$selectGiftee = "SELECT * FROM SecretSantas ORDER BY RAND() WHERE 'Gifter' = '' LIMIT 0,10";
$results = mysql_query($selectGiftee);
$row = mysql_fetch_array($result);
$gifteeResults = $row['Name'];
$addSS = "UPDATE SecretSantas SET Gifter = '$SS' WHERE Name = '$gifteeResults'";
mysql_query($addSS);
$done=true;
return $gifteeResults;
}
echo mysql_error();
mysql_close($sqllink);
}
}
if(isset($_POST['Submit'])){
$echoName = functions::chooseGiftee($_POST['gifterName']);
echo $echoName;
}
This is my form code:
<form id="form1" name="form1" method="post" action="">
<p>Type in your name below (Ex: Brandon Layton) and your Giftee will be generated for you.</p>
<p>
<label>Your Name:
<input type="text" name="gifterName" id="gifterName" />
</label>
<input type="submit" name="submit" id="submit" value="Submit" />
</p>
<p>*</p>
</form>
Hopefully you can find out why it isnt working and explain to me?
Thanks,
Brandon
class functions {
public static function chooseGiftee($SS){
$done = false;
$sqllink= mysql_connect($mysql_host,$mysql_user,$mysql_password);
if(!$sqllink){
echo "Could not connect! Please Try Again";
mysql_close($sqllink);
} else {
$selectGiftee = "SELECT * FROM SecretSantas ORDER BY RAND() WHERE 'Gifter' = '' LIMIT 0,10";
$results = mysql_query($selectGiftee);
$row = mysql_fetch_array($result);
$gifteeResults = $row['Name'];
$addSS = "UPDATE SecretSantas SET Gifter = '$SS' WHERE Name = '$gifteeResults'";
mysql_query($addSS);
$done=true;
return $gifteeResults;
}
echo mysql_error();
mysql_close($sqllink);
}
}
if(isset($_POST['Submit'])){
$echoName = functions::chooseGiftee($_POST['gifterName']);
echo $echoName;
}
This is my form code:
<form id="form1" name="form1" method="post" action="">
<p>Type in your name below (Ex: Brandon Layton) and your Giftee will be generated for you.</p>
<p>
<label>Your Name:
<input type="text" name="gifterName" id="gifterName" />
</label>
<input type="submit" name="submit" id="submit" value="Submit" />
</p>
<p>*</p>
</form>
Hopefully you can find out why it isnt working and explain to me?
Thanks,
Brandon