Solved

Not Getting Client ID

Posted on 2015-02-01
6
58 Views
Last Modified: 2015-02-01
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
Comment
Question by:DS928
  • 3
  • 2
6 Comments
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 40582558
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
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 40582565
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 40582566
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:DS928
ID: 40582589
I am sorry.  I think this is beyond me at this point.  How do I add session start to 7formsubmit.php
0
 
LVL 31

Accepted Solution

by:
Marco Gasi earned 500 total points
ID: 40582590
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
 

Author Closing Comment

by:DS928
ID: 40582592
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question