Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

Generating a new HTML page with a PHP script with PHP inside

Yea quite complicated eh? :(

I have a form (let's say it's called index.html) which goes to main.php, from there it takes the info put into index.html (the person's email for example) and then creates a new page with the info.

The problem I'm having is how to make it actually make a new page with PHP inside. Basically, I need it to be able to write variables inside the file, but it keeps trying to locate the variable inside the script used to make it in the first place.. Help please <3

EDIT:

an example of what's happening; I use this in main.php to specify what I want inside the file:

Code
$content = "<?php \n $example = "example"; \n ?>";

Then that would show inside the newly created file with blanks where the variable $example would be D:


Solved! fillerfillerfillerfillerfillerfiller
You cannot execute PHP inside a .html document, that may be your issue. As for the variables not being found, You'll have to use the post/get function.
If you still need help, add my Skype: RATRage

Or just PM me
Contact me for Programming Lessons and Services.
(Aug 3, 2012 07:13 PM)Tom` Wrote:  You cannot execute PHP inside a .html document, that may be your issue. As for the variables not being found, You'll have to use the post/get function.

You can use .Htaccess to show a .php file as a .html file with the following code:

Code
Options +FollowSymLinks +Indexes
RewriteEngine on
RewriteBase /
RewriteRule ^([^.]+)\.html$ $1.php [L]
Русский - Веб-разработчик - эксперт Linux
(Aug 3, 2012 07:13 PM)Tom` Wrote:  You cannot execute PHP inside a .html document, that may be your issue. As for the variables not being found, You'll have to use the post/get function.

You actually can do this but you need to setup PHP to do so since it's not down by default.
You CAN do it by doing <?php The script here ?> ~.~

EDIT: btw I solved this yesterday, just added a backslash like so:

\$example


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Javascript]  by flexing_99Apr 29, 2023 12:02 AM 3 269 Apr 29, 2023 12:02 AM
Last Post: Zgh600
[PHP] by GeatzoDec 28, 2022 02:07 PM 0 150 Dec 28, 2022 02:07 PM
Last Post: Geatzo
[PHP] by HackersFeb 11, 2022 12:01 AM 8 546 Feb 11, 2022 12:01 AM
Last Post: Hackers