I want to make a form which takes information then uses that information on another page when it is submitted. However once it redirects, it loses all the information from the other page for example:
Page 1:
<?php
if(isset($_POST['submit']))
{$info=$_POST['info'];}
?>
<html>
<form action='page2.html' method='POST'>
<input name='info'>
<intput type='submit' name='submit'>
</form>
</html>
Page2:
<?php
echo $info;
?>
it doesn’t know what the variable ‘info’ is on page 2.
Add:
and remove:
Now reasons:
When you submit a form it’s redirected to a page written in
actionattribute offormtag and sends form data to it. So after submitting form you are on thepage2where you have access toposteddata.