0

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??

Edited by nats01282: added extra code

3
Contributors
10
Replies
11
Views
6 Years
Discussion Span
Last Post by Setvir
Featured Replies
  • 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: [URL="http://www.tizag.com/phpT/filewrite.php"]Writing to a file[/URL] [URL="http://www.freewebmasterhelp.com/tutorials/phpmysql"]Saving to MySql database[/URL] Read More

0

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.

0

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,

Edited by nats01282: n/a

0

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

0

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,

0

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

0

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

Edited by nats01282: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.