• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

PHP question :)

paruhd0x

Diamond Member
Well, I am pretty novice at PHP, but I am asking here since I couldn't find my answer from friends/book/or google.

What I am trying to do is I have a page that posts data into some snazzy template. Then have a form button at the bottom of that page post the html code including the printed stuff from the previous form submit to another page in pre tags so someone could easily highlight and copy and paste the code.

I've tried several different ways, and I cannot seem to get it to work. Any help is appreciated.
 
Uh... can't think of any way to help you short of writing it myself. E-mail the template to me and I'll give it a shot (e-mail address is in profile).

Edit: I'm not sure the pre tag does what you want it to. Look up the function htmlspecialchars() on php.net, that does what you want.
 
The simplest way to do this might be to make the php create a file, then call that file on the next page...

Work out some psuedo-code and outlining first and it may better help describe your situation.


-use forms to gather data
-use php functions to format data
-write formatted data to a file
-move to next page

*next page loads*

-form text box is displayed
--temp file from previous page is called via php
--contents of temp file displayed in form text box
-contents can be copied pasted into next document at user's will


Is that what you are looking for?

 
Ok I am not quite surei understand your question, but here goes.
<!-- Page one -->
<html>
<head>
<title>Page One</title>
</head>
<body>
Enter info to fill in template.
<form method="post" action="post.php">
Title: <input type="text" name="title">

Message: <input type="text" name="message">

</form>
</body>
</html>


<!-- Page two -->
<?php
$template = "<table><tr><td>$_POST['title']</td></tr><tr><td>$_POST['message']</td></tr></table>";

echo "
<html>
<head>
<title>Page two</title>
</head>
<body>
Here is what the template looks like:
".$template."


Here is the code for the template:

<pre>".$template."</pre>
</body>
</html>
?>

//You can put < b r > tages in there if you want...I tried to, but you cant see them cuz fusetalk treats them like HTML
 
Thanks guys, I ended up figuring it out. Thanks for your suggestions! Well appreciated.

I ended up not having to create a file, just set the inputted html + variables as a variable then in the form stuff made the hidden input value that variable and used the function htmlspecialchars() and the one that removes slashes also.
 
Back
Top