I have a form where a user can fill in a brief amount of information. They then go to the next page where they review the information or go back and edit it. I am using sessions to save the data from the form. The code on the form is as below:
<?php
session_start();
$title = stripslashes ($_SESSION['title']);
$artist = stripslashes ($_SESSION['artist']);
$description = stripslashes ($_SESSION['description']);
?>
<form name="form1" method="post" action="review.php">
<p align="justify">
title:<br>
<input name="item_title" type="text" id="item_title" value="<?php echo $title; ?>" size="50">
</p>
<p align="justify">description:<br>
<textarea name="item_description" cols="40" rows="3" id="item_description"><?php echo $description; ?></textarea>
</p>
<p align="justify">
<input type="submit" name="Submit" value="Submit">
</p>
</form>
The code on the review page is as follows:
<?php
session_start();
$_SESSION['title'] = $_POST['item_title'];
$_SESSION['description'] = $_POST['item_description'];
echo "<p align=\"justify\"><b class = \"highlight\">title: </b>".stripslashes($_POST['item_title'])."</p>
<p align=\"justify\"><b class = \"highlight\">description: </b>".stripslashes($_POST['item_description'])."</p>
<p align=\"justify\"><a href=\"save_item.php\">save this item</a></p>
<p align=\"justify\"><a href=\"new_item.php?type=2\">go back and edit this item</a></p>";
The problem comes if someone puts some speech marks in the title field. It echoes it all on the review page fine but if they choose to go back and edit it when it redisplays the data it deletes the speech marks and everything after them
The thing thats really confusing me is that it isnt doing it on the description text field 😕 Please Help!!