I am creating a page, which takes the user through a few forms. I set the SESSION variables to store the data, however they are not saving. Is there something I'm missing?
At the top of the page I have session_start()declared before the HTML tags.
This particular instance it's declared, but then the value is lost
?>
<form role="form" class="title" method="POST" action="?action=materials">
<label for="title">Project Title</label>
<input type="text" name="title" value="">
<label for="description">Description</label>
<textarea name="description"></textarea>
<input type="submit" name="submit" value="next>">
</form>
<?php
$title = Input::get("title"); //Input::get() gets form values
$description = Input::get('description');
$_SESSION["title"] = $title; // set SESSION variable
$_SESSION["description"] = $description;
echo $_SESSION["title"], $_SESSION["description"]; // prints variable... works beautifully
?>
<form class="my-form" role="form" method="POST" action="?action=steps">
<p class="text-box">
<label for="materials">Materials</label>
<p class="text-box">
<label for="url">URL</label>
<a class="add-box" href="#">Add Material</a>
</p>
<input type="submit" name="submit" id="btnsbmit" value="next>">
</form>
<?php
$elems = Input::get("elem1");
echo $_SESSION["title"], $_SESSION["description"]; // print same session variable... does not print
?>
<!--more code-->