Jump to content

preview pages


nicolemcgrgr50

Recommended Posts

Hi all,

 

I am creating a website where the user can upload an advert. However, i want to add a preview function (similar to the one on this website when you create a new thread).

 

Currently, i have created a form which passes data on to a confirmation page:

PHP Code:

<form action="confirm.php" method="POST">

              <input type = "text", name="make">

              <input type = "text", name="model">

 

I would then like confirm.php to display the advert preview. Below the display i would like to include the same form allowing updates to be made. Any suggestions/guidance on how this can be done?

 

My first thoughts are to post the data back to the same page. However, how do you get the form to hold the data input by the user?

 

e.g.

PHP Code:

<input type = "text", name="make" value=<?$make?>> where $make = $make=$_POST['make'];

does not work.

Link to comment
https://forums.phpfreaks.com/topic/138450-preview-pages/
Share on other sites

You can send the form in post method to the same page,

and display it like this:

<?php echo $make; ?>

And not:

<?$make?>

 

Just make sure that when you display it,

you clean the string from XSS. You can use htmlentities.

 

For example:

$make = htmlentities($_POST['make'], ENT_QUOTES, 'UTF-8');

Link to comment
https://forums.phpfreaks.com/topic/138450-preview-pages/#findComment-723892
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.