Ph0enix Posted May 10, 2006 Share Posted May 10, 2006 Ok i have to problems and i would really appreciate any help with these.1) I'm making a gaming league and i would like people to report games when they have won. I know how to make a HTML form but then when i send the info to a php script how do i turn the information into variables so i can use then further down in the script.2) My second problem is that when people report a game i would like 5 points to be added to the points but i cant do it. I dont get an error but the script just doesnt work.. This is my script.[code]$name = "Ph0enix";$db = mysql_connect("HOST", "USERNAME" , "PASSWORD");mysql_select_db('DBNAME');mysql_query("UPDATE points SET points = points + 5 WHERE user_name= $name");[/code]Can anyone please tell me what im doing wrong and help me!Thanks! Quote Link to comment Share on other sites More sharing options...
alpine Posted May 10, 2006 Share Posted May 10, 2006 1: You can use $_POST for this[code]if(isset($_POST['submit'])){$field_1 = htmlspecialchars($_POST['field_1']);}else{echo <<<__HTML_END<form action="page.php" method="post">Field 1: <input type="text" name="field_1" value="" size="30" /><input type="submit" name="submit" value="Submit Form" /></form>__HTML_END;}[/code]2: add single quotes around $user,mysql_query("UPDATE points SET points = points + 5 WHERE user_name= [!--coloro:#CC0000--][span style=\"color:#CC0000\"][!--/coloro--]'[!--colorc--][/span][!--/colorc--]$name[!--coloro:#CC0000--][span style=\"color:#CC0000\"][!--/coloro--]'[!--colorc--][/span][!--/colorc--]") or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
Ph0enix Posted May 10, 2006 Author Share Posted May 10, 2006 YYYEEEAAAHHH!!! It works! Thanks a lot mate you helped loads! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.