Jump to content

Archived

This topic is now archived and is closed to further replies.

RobRocker

Help with passing variables

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
I tried doing $id = echo $_GET['id_eve']; and that was a syntax error... I thought I would give it a try anyways.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.