Hi, I'm a web development newbie. I was wondering if this was possible:

Say there's a page where you submit a value in a form, and when you click submit it links to another page. Then that page links to a few more pages. Would you be able to retrieve (and print) the value you submitted in the form on the first page from a page that's not directly connected to it? Would using cookies or sessions work? I'm not sure where to start.

Would using cookies or sessions work? I'm not sure where to start.

Yes of course its very possible and common but not with HTML alone. Based on your description, you are going to need server side scripting (php, asp.net, jsp, etc..).

How you cary the information from page to page depends on you. Yes it can be done with cookies, session variables, and even reading and writing to a database table(s).

There is no right and wrong, just using the best tool for the job. Its hard to say what the appropriate approach is going to be without really knowing all of hte details, but this should get you going...

Thank you for responding. How do you use session variables across different pages? If I do this on one page:

$first_name = $_POST['name'];
$_SESSION['first_name'] = $first name;

And this on another:

echo $_SESSION['first_name'];

It says it's undefined.

session_start();
    if ( isset($_POST['name']) ){
            $_SESSION['first_name'] = $_POST['name'];
            }

    $first name = ( isset($_SESSION['first_name']) ? $_SESSION['first_name'] : "");

    echo $first name;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.