1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

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

    Likes Received:
    Best Answers:
    Trophy Points:
    okay had some success:

    page one form name for email = email
    page two (with php) : [B]$email = $_POST['email'];[/B]
    [B]echo $email;[/B]
    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):

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

    D3Tek Active Member

    Likes Received:
    Best Answers:
    Trophy Points:
    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