RobRocker Posted September 21, 2006 Share Posted September 21, 2006 Howdy everyone.I am having trouble passing a $_GET variable. It is "getting" it correctly but it wont pass it to next site.Here is my code that I am trying to get to work. Now when I pass this I get a error that says.[quote]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 '' at line 1[/quote][code]$id = $_GET['id_eve'];$MM_redirectLoginSuccess = "calenderedit.php?id_eve=$id";[/code]Here is the scenario...I have a dynamic calendar view page, it loads id_eve and grabs the correct information from the database. I have a "Login to Edit" form at the bottom of the page. Which is what the redirectLoginSuccess variable is for. Now when I hit the sumbit form information button it send me to the site but it just has "calenderedit.php?id_eve=" in the address bar but no variable....Can you help? BTW I have all my code like this above the html tags. Link to comment https://forums.phpfreaks.com/topic/21491-help-with-passing-variables/ Share on other sites More sharing options...
trillion Posted September 21, 2006 Share Posted September 21, 2006 try this maybe$id = $_GET['id_eve'];$MM_redirectLoginSuccess = "calenderedit.php?id_eve=".$id; Link to comment https://forums.phpfreaks.com/topic/21491-help-with-passing-variables/#findComment-95834 Share on other sites More sharing options...
RobRocker Posted September 21, 2006 Author Share Posted September 21, 2006 No that didnt work. *sigh*Here is my whole code.[code]<?php require_once('Connections/calendar.php'); ?><?php$colname_Recordset1 = "-1";if (isset($_GET['id_eve'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['id_eve'] : addslashes($_GET['id_eve']);}mysql_select_db($database_calendar, $calendar);$query_Recordset1 = sprintf("SELECT * FROM rsCalendar WHERE id_eve = %s", $colname_Recordset1);$Recordset1 = mysql_query($query_Recordset1, $calendar) or die(mysql_error());$row_Recordset1 = mysql_fetch_assoc($Recordset1);$totalRows_Recordset1 = mysql_num_rows($Recordset1);?><?php // *** Validate request to login to this site.if (!isset($_SESSION)) { session_start();}$id = $_GET['id_eve'];$loginFormAction = $_SERVER['PHP_SELF'];if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck'];}if (isset($_POST['email'])) { $loginUsername=$_POST['email']; $password=$_POST['password']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "calenderedit.php?id_eve=".$id; $MM_redirectLoginFailed = "calender.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_calendar, $calendar); $LoginRS__query=sprintf("SELECT user_email, user_pass FROM rsCalendar_users WHERE user_email='%s' AND user_pass='%s'", get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); $LoginRS = mysql_query($LoginRS__query, $calendar) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); }}?>[/code] Link to comment https://forums.phpfreaks.com/topic/21491-help-with-passing-variables/#findComment-95842 Share on other sites More sharing options...
trillion Posted September 21, 2006 Share Posted September 21, 2006 what do you get for a simple echo $_GET['id_eve']; Link to comment https://forums.phpfreaks.com/topic/21491-help-with-passing-variables/#findComment-95846 Share on other sites More sharing options...
RobRocker Posted September 21, 2006 Author Share Posted September 21, 2006 When I do a "print_r" I get the correct variable... Link to comment https://forums.phpfreaks.com/topic/21491-help-with-passing-variables/#findComment-96034 Share on other sites More sharing options...
RobRocker Posted September 21, 2006 Author Share Posted September 21, 2006 I tried doing $id = echo $_GET['id_eve']; and that was a syntax error... I thought I would give it a try anyways. Link to comment https://forums.phpfreaks.com/topic/21491-help-with-passing-variables/#findComment-96152 Share on other sites More sharing options...
wildteen88 Posted September 21, 2006 Share Posted September 21, 2006 remove echo and it'll work. So do this:$id = $_GET['id_eve']; Link to comment https://forums.phpfreaks.com/topic/21491-help-with-passing-variables/#findComment-96157 Share on other sites More sharing options...
RobRocker Posted September 21, 2006 Author Share Posted September 21, 2006 Ive tried that, and it wont pass the variable. Link to comment https://forums.phpfreaks.com/topic/21491-help-with-passing-variables/#findComment-96233 Share on other sites More sharing options...
RobRocker Posted September 21, 2006 Author Share Posted September 21, 2006 Ok, Well since that is giving me trouble. I had another idea.I know in PHP you can have modules that are shown depending on certain situations. Can I make a module that after the person logs in, it "unlocks" a module so the person can access that module?If that is possible can anyone give me resources on how to do it? Link to comment https://forums.phpfreaks.com/topic/21491-help-with-passing-variables/#findComment-96270 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.