0

I reviewed Storing Form Data as a Session Variable but can't quite get it working for me and I have nearly the same code. Any suggestions are appreciated!

<?php
session_start();    
?>  

    <form action="checkout.php" method="post">
    <div>
        Customer ID: <input type="text" name="customer_id" />
    </div>
    <input type="submit" name="checkout" value="Checkout" />
    </form>
    ';

<?php 
    if (isset($_POST['checkout'])) { 
       $_SESSION['customer_id'] = $_POST['customer_id'];
    } 
?>

The code above doesn't work, but the below does. I am typing the same number in the text box.

<?php
    $_SESSION['customer_id'] = 1024;
?>

1 Answers1

-1

https://www.php.net/manual/ru/language.variables.superglobals.php use $_SESSION not $_session pay attention to the case, global variables are written in upper case.