PHP Form error with session

Discussion in 'PHP' started by l3l00, Mar 14, 2013.

  1. #1
    I am so close to having this thing working.

    Basically I have a form that submits to a checkout page where people would put in their info. I have a php that extends out a special array for a CRM API.

    I did a print_r ($url); to see the results of an eror I am getting.

    The name on the form is called email, inside the php I have it as $email = "email"; so it should choose the users input and send it to the API. However in the debug results I get an error message because it was trying to send: &email=email. I have at the top a session_start(); but I think I need to add more to the session just do not know the syntax.
     
    l3l00, Mar 14, 2013 IP
  2. l3l00

    l3l00 Greenhorn

    Messages:
    58
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #2
    okay had some success:

    
    page one form name for email = email
     
    page two (with php) : [B]$email = $_POST['email'];[/B]
    [B]echo $email;[/B]
     
    [code]
     
    It does, but it refuses to allow anything else?
    nextone is name (form name = fname)
     
    [B]$fname = $_POST['fname'];[/B]
    [B]echo $fname;[/B]
    
    Code (markup):
    results:

    Notice: Undefined index: fname in ~/checkout.php on line 7[/code]
     
    l3l00, Mar 14, 2013 IP
  3. D3Tek

    D3Tek Active Member

    Messages:
    164
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    50
    #3
    I don't understand what this has to do with sessions, as $email = $_POST['email']; is not a session.

    Basically, if $email is empty, that's because $_POST['email'] is also empty.
    The undefined index error is a notice, not an error. These can be ignored, however it is good practice to fix them.

    $fname = isset($_POST['fname']) ? $_POST['fname'] : null;
     
    D3Tek, Mar 15, 2013 IP