Solved

Not Getting Client ID

Posted on 2015-02-01
6
62 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

630 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