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

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

    Code (Text):
    1.  
    2. page one form name for email = email
    3.  
    4. page two (with php) : [B]$email = $_POST['email'];[/B]
    5. [B]echo $email;[/B]
    6.  
    7. [code]
    8.  
    9. It does, but it refuses to allow anything else?
    10. nextone is name (form name = fname)
    11.  
    12. [B]$fname = $_POST['fname'];[/B]
    13. [B]echo $fname;[/B]
    14.  
    results:

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

    D3Tek Active Member

    Messages:
    137
    Likes Received:
    5
    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