Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 73
  • Last Modified:

Not Getting Client ID

I am trying to grab the ClientID when I make a new record but it's always coming up 0.  So the 7formsubmit.php isn't grabbing it.  Am I missing something?  Is it something to do with opening a SESSION?  I grabbed the code from the clientlogin.php.
clientlogin.php
7formsubmit.php
0
DS928
Asked:
DS928
  • 3
  • 2
1 Solution
 
Marco GasiFreelancerCommented:
At the first look, I see you don't have session_start() in 7formsubmit.php: you have to put session_start in every script, otherwise wou'll can't access session data.
0
 
Marco GasiFreelancerCommented:
In both script is missing a line where you put the clientID in the session array, nor I see any form where the user can do the login nor I see any code which processes user data and checks username and password... That is I don't see anything I should see :-) Am i blind?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
DS928Author Commented:
I am sorry.  I think this is beyond me at this point.  How do I add session start to 7formsubmit.php
0
 
Marco GasiFreelancerCommented:
Simply writing

session_start();

at the very top of the script. But you have to put the clientID into the session array first. Unless you did it on another part of your code...
0
 
DS928Author Commented:
This worked.  Thank you.

<?php
//set_error_handler("var_dump");
              include("7conn.php");
              $mode=$_GET["mode"];
              session_start();
              if($mode=="add") {
                    $recordCust=$_POST["recordCust"];
                  $recordSite=$_POST["recordSite"];
                  $recordUser=$_POST["recordUser"];
                  $recordPass=$_POST["recordPass"];
                  $sql="insert into records(recordCust,recordSite,recordUser,recordPass,recordDateAdded) values('" . $_SESSION['clientID'] . "','$recordSite','$recordUser','$recordPass', Now())";
                  $result=mysql_query($sql,$connection) or die(mysql_error());
                  header("location: clientlogin.php");
              } elseif($mode=="update") {
                    $recordSite=$_POST["recordSite"];
                  $recordUser=$_POST["recordUser"];
                  $recordPass=$_POST["recordPass"];
                  $recordId = $_POST["recordId"];
                  $sql="update records set recordSite='$recordSite',recordUser='$recordUser',recordPass='$recordPass'  where recordId='$recordId'";
                  //echo $sql;
                  $result=mysql_query($sql,$connection) or die(mysql_error());
                header("location: clientlogin.php");
              }
?>
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now