I know this is normally a basic and very general error, but I cannot figure out how I am getting it.
I am trying to program a specific event calendar, the issue is on one of the events. I am trying to allow users to rate other users that went to the event.
The below code lists the users, and attempts to send a variable via Ajax to another page that processes the SQL.
CODE
---------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
- $result2 = mysql_query("SELECT gp_event_user FROM gp_event_users WHERE gp_event_id='" . $ev_id . "'");
- while($participant_row = mysql_fetch_array($result2))
- {
- echo "
- <div class='pingit'>
- <div id='navvcontainer'>
- <ul id='navvlist'>
- <form><input type='hidden' id='eventnumber' value=" . $ev_id . " disabled='disabled' />
- </form>
- <li><img src='http://localhost/comm/img/up2.gif' class='pointer' onmousedown='ajaxPingUp(" . $participant_row['gp_event_user'] . ")' border='0' /></li>
- <li><a class='middle' href='#'>";
- echo $participant_row['gp_event_user'];
- echo "<font color='#FF5F11'>[24]</font></a></li>
- <li><a class='out' href='#'><img src='http://localhost/comm/img/down2.gif' border='0' /></a></li>
- </ul>
- </div>
- </div>
- ";
So basically this code lists the users, and if you click on a user it processes the Ajax function "ajaxPingUp" and sends the specific user you click on. When I click on a user I get:
Error: "the name of the user written here" undefined.
I don't recall every using the user as a variable, it's not even close to the code I'm writing.
Below is the Ajax page that is supposed to send the specific user that is supposed to get the vote.
CODE
---------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
- function ajaxPingUp(gp_event_user){
- var ajaxRequest; // The variable that makes Ajax possible!
- try{
- // Opera 8.0+, Firefox, Safari
- ajaxRequest = new XMLHttpRequest();
- } catch (e){
- // Internet Explorer Browsers
- try{
- ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try{
- ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e){
- // Something went wrong
- alert("Your browser broke!");
- return false;
- }
- }
- }
- // Create a function that will receive data sent from the server
- ajaxRequest.onreadystatechange = function(){
- if(ajaxRequest.readyState == 4){
- var ajaxDisplay = document.getElementById("ajaxDiv");
- ajaxDisplay.innerHTML = ajaxRequest.responseText;
- }
- }
- var useraccount = document.getElementById("useraccount").value;
- var ev_id = document.getElementById("eventnumber").value;
- ajaxRequest.open("GET", "ajaxPingUp.php?gp_event_user=" + gp_event_user + "&eventID=" + ev_id + "&useraccount=" + useraccount + "&ms=" + new Date().getTime(), true);
- ajaxRequest.send(null);
- }
On the ajaxPingUp.php page I just want to be able to use " $_GET['gp_event_user']".
If you notice some quarky code, it's because I've been beating my head against the keyboard trying to figure this out. I've got everything to work expect this part. I've even used this Ajax method before to send specific Array values. Any help would be greatly, greatly appreciated. Thanks,