egiblock Posted July 21, 2009 Share Posted July 21, 2009 i have a javascript that passes a variabe from a form to another window for processing.. form: ... <form name="CourseSelection"> <select name="selectedCourseID" onChange="pullCourse();" id="selectedCourseID"> <option value="0" selected>Select a Course</option> ....... pullcourses.js: ........ ajaxRequest.open("GET", "geteventtoaddscore.php?ecid=" + document.getElementById('selectedCourseID').value, true); ........ it passes the line: http://localhost/test1/geteventtoaddscore.php?ecid=3 getevent...php: <?php $ecid = $_POST['ecid']; mysql_select_db($database_golfscoring, $golfscoring); $query_EventListing = "SELECT * FROM tbl_events WHERE $ecid = tbl_events.eventCourseID" ; it is throwing the error from the above sql statement. Notice: Undefined index: ecid in C:\wamp\www\test1\geteventtoaddscore.php on line 4 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= tbl_events.eventCourseID' at line 1 Quote Link to comment Share on other sites More sharing options...
xtopolis Posted July 22, 2009 Share Posted July 22, 2009 edit You're using GET , not POST to send the data. Change it to post, or change the line below to GET you should sanitize your input! $ecid = (int) $_POST['ecid']; Isn't this last part backwards? $query_EventListing = "SELECT * FROM tbl_events WHERE $ecid = tbl_events.eventCourseID" ; instead: $query_EventListing = "SELECT * FROM tbl_events WHERE tbl_events.eventCourseID = $ecid" ; Quote Link to comment Share on other sites More sharing options...
egiblock Posted July 22, 2009 Author Share Posted July 22, 2009 here's the final code that worked. thanks for the help. this php stuff is all new to me $ecid = $_GET['ecid']; mysql_select_db($database_golfscoring, $golfscoring); $query_EventListing = "SELECT * FROM tbl_events WHERE tbl_events.eventCourseID = $ecid" ; 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.