if i use this code

page1.php

<form action="" method="post" >
First <input type="text" name="first" />
last <input type="text" name="last" />
<input type="submit" />
</form>
<a href="page2.php?first=<?php echo $_POST['first'] ?>&last=<?php echo $_POST['last'] ?>">click here</a>

page2.php

<?php
session_start();
define ('first', $_GET['first']);
define ('last', $_GET['last']);

?>
<p>information submitted thank you, <a href="page3.php">click here</a></p>

page3.php (the page users see)

<?php include_once 'page2.php' ?>
<p>First = <?php echo defined (first); ?> </p>
<p>Last = <?php echo defined (last); ?> </p>

will people who vist page3.php be able to see what information i put into page1.php ??

also just tried using sessions and still nothing appears on page3.php

page2.php

<?php
session_start();
$_SESSION['first'] = $_GET['first'];
$_SESSION['last'] = $_GET['last'];

?>
<p>information submitted thank you, <a href="page3.php">click here</a></p>

page3.php

<?php 
include_once 'page2.php'; 
session_start();
?>

<p>First = <?php echo $_SESSION['first']; ?> </p>
<p>Last = <?php echo $_SESSION['last'];  ?> </p>

what am i missing??

Member Avatar for diafol

will people who vist page3.php be able to see what information i put into page1.php ??

Have you tried it?

I don't understand why you'd want to place a var into a constant. Doesn't make much sense to me.

yes i have tried it and its not working, i have never touched this side to php before always wrote the script on 1 page, but now i need to enter data on 1 page and show it on anther.

I don't understand why you'd want to place a var into a constant. Doesn't make much sense to me.

i thought if i define it, i can use the defined on anther page to display it, like i said i have never touched this side to php before so this is new to me,

managed to send a variable but now i am after saving the variable so it will show constantly on any computer,

Member Avatar for diafol

Just put it into another variable:

$myvar = $_GET['whatever'];

Just put it into another variable:

$myvar = $_GET['whatever'];

When using that if i access the page via a diffrent computer i still cannot see what i set on anther computer,

When using that if i access the page via a diffrent computer i still cannot see what i set on anther computer,

i need to enter information on page1.php send it to page2.php,
and people viewing my site needs to see whats on page2.php untill i update it with editing page1.php

Hi nats01282,
You will need to save the data you have entered on the first page either to a database like MySql or you can save it to a file.

Here are tutorial links:
Writing to a file
Saving to MySql database

Another tutorial on sving data:
Form to flat file

Hope it helps!

Hi nats01282,
You will need to save the data you have entered on the first page either to a database like MySql or you can save it to a file.

Here are tutorial links:
Writing to a file
Saving to MySql database

good idea setvir never thought of that,
hopefully this will work

Ok, found a much better tutorial for your use.

Flat file database demo

At the bottom there is a link to a second tutorial that explains how to do more advanced things like sorting.

To delete a file you can look at the following tutorial:
Unlink function

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.