...

View Full Version : Php + html = ftl?



WorldVision
05-12-2009, 10:48 AM
So I am trying to pass a variable from one html page to another using php, and then on the second page pass the variable contents into my email sign up when the user signs up. I am doing this for tracking purposes.

But I can't get the php to work, I know I have php installed on the server, and I have tried adding "AddType application/x-httpd-php .html" and "AddType application/x-httpd-php .htm" to my .htaccess file, but it only produces an pop up when I go to any of my sites pages saying "You have chosen to open..."

Here is the code itself

Page 1
The link on my "articlea" page sending the user to the newsletter sign up is like so:

http://www.mysite.com/newsletter.html?var=articlea


Page 2
The on the newsletter sign up page, I added this to my header:


<?php
$val = $_GET['var'];
?>

Then in my submit form, I have added this to pass the variable info on to my mailing list.


<input type="hidden" name="custom tid" value="<?php echo "$val"; ?>">


I am not a pro at this stuff, maybe someone here can see the mistake I am making. Thanks guys!

luckyfella73
05-12-2009, 12:07 PM
hi,

though I'm not sure if the whitespace in the name attribute of
the hidden input field can cause problems that seem not to be
the main problem.
To check if PHP is running on your server set up a file containing:


<?php
phpinfo();
?>


save as info.php or whatever you prefer, upload to your webserver
and call it directly with your browser. If you get a table with plenty
of informations about your webserver, PHP is running. If not you will
have to upgrade your hosting account.
If PHP is installed than you don't need to put the mentioned code
in your htaccess.

Hope that get you on the right track.

hkp
05-12-2009, 01:08 PM
you can take help form this link. hope this link is very helpful for you.

http://mrarrowhead.com/php_tutorials_mah/php_passing_variables.php

WorldVision
05-13-2009, 12:38 AM
So after looking over the input I think I am doing everything right, but my problem is the pages I am trying to pass the variable through are html NOT php. I think this is what is causing the problem...

http://www.mysite.com/newsletter.html?var=articlea


How can I go about getting around this? Is there a way to pass variable from page to page with html? Or is there a way to make my html page a php page without much trouble?

What do you guys think is my best route?

mOrloff
05-13-2009, 12:52 AM
Easiest way to make an HTML page into PHP is simply to change the file extension.
The server will then know to expect html, and parse all php into html before sending it to the client.

If I'm incorrect here, somebody please set me straight.

HTH
~ Mo

WorldVision
05-13-2009, 03:22 AM
Easiest way to make an HTML page into PHP is simply to change the file extension.
The server will then know to expect html, and parse all php into html before sending it to the client.

If I'm incorrect here, somebody please set me straight.

HTH
~ Mo


Sweet this completely fixed my problem, but can someone verify that this a solid way to go about things. I don't want this to cause problems with some users.

sea4me
05-13-2009, 03:41 AM
ya that is how u make a php file.

Or you can make html be processed by php.... :thumbsup:

developoor
05-15-2009, 03:01 AM
There are many ways to run .html as .php

if you have no access to httpd.conf try to do it with .htaccess.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum