Hi all,
Really need some help here. I dont know ajax myself, Iv been researching through the topics here on the site and youtube to get some help. I have created a php file for database connection and variables set up to hold the POST values from construct. The event page of construct is sending a name called 'lance' and the users input into my textbox called 'chatinput'. It all looks ok, but yet nothing is being inserted into the databse when I run the game no matter what Iv tried. There is a connection being made from the php file to my database as Iv tested that, but it seems to be an issue with the ajax part of either sending the values to the php file properly, or the php file isnt picking them up properly??
I am so lost and this game is part of a project Im trying to do for college so Im very stuck at the moment.
Any help would be very appreciated.
Code is below:
gameconnect.php file
<?php
header('Access-Control-Allow-Origin: *');
require("db_connect.php"); // call to connection file
include("functions.php");// include funtions file
$db_link = db_connect("game"); //select database
connect($db_link); //call to connect to db function
$fn=$_POST['fname']; //variable for holding fname' lance' from consrtruct2
$answer =$_POST['input']; // variable for user input text
mysql_query("INSERT INTO useranswers(pps, text) VALUES ('$fn', '$answer')");
?> //******end of php file******
***CONSTRUCT2***
parameters for AJAX POST to url section, in the data field this is the instruction I have:
"fname='lance'&input='" & chatinput.text & "'"