graham23s Posted October 19, 2008 Share Posted October 19, 2008 Hi Guys, i have coded a basic html textarea box where the user can input html formatting to send via mail() i was going to add a preview button to show it (html formatted etc) before sending, im wondering what would be the best way to do this? any advice would be great! cheers Graham Link to comment https://forums.phpfreaks.com/topic/129082-previewing-textarea-box/ Share on other sites More sharing options...
robcrozier Posted October 19, 2008 Share Posted October 19, 2008 I think a quick and simple way to do this Graham would be to define a <div></div> using CSS with a fixed width and height, with overflow set to auto. I would then hide this until the user has clicked on the preview button using something like: if (isset($_POST['preview'])) { // show div echo "<div class='textBoxPreview></div>"; } else { // do nothing } No all you need to do is add the preview form button to your form. When the form is submitted, collect the data that is posted from the textbox and echo it into the div you defined. The div will act as a sort of viewport where the user will see the html that they have input. Hope that helps Rob Link to comment https://forums.phpfreaks.com/topic/129082-previewing-textarea-box/#findComment-669281 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.