passing data around
Posted: Mon Oct 27, 2008 12:14 am
I've been trying to work out how to pass data around between php files. The idea being data from a form would go to a controller for processing then passed to a view page for display. The practice example that I made for myself has three pages: first.php, second.php and you guessed it, third.php
first.php sends the selected item to second.php
second.php takes the data sends it on to third.php. I realise there is no commands to send the data on, this is where I am clueless.
third.php displays the data.
In first.php I would use the forms 'action' element, triggered by submit, to send the data to second.php but I don't know how to send from second.php to third.php.
Also what is this called? I tried searching for an answer but it has been fruitless as I am uncertain of the terminology.
Thanks in advance.
first.php sends the selected item to second.php
Code: Select all
<form action='second.php' method="post">
<select name="sltTopic">
<option>A</option>
<option>B</option>
<option>C</option>
</select>
<input type="submit" value="Enter" />
</form>
Code: Select all
<?php
$option = $_POST['sltTopic'];
?>
Code: Select all
<h1>$option</h1>
Also what is this called? I tried searching for an answer but it has been fruitless as I am uncertain of the terminology.
Thanks in advance.