Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Dec 2008
    Posts
    33
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Php + html = ftl?

    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:

    Code:
    <?php
    $val = $_GET['var'];
    ?>
    Then in my submit form, I have added this to pass the variable info on to my mailing list.

    Code:
    <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!

  • #2
    New to the CF scene
    Join Date
    May 2009
    Posts
    4
    Thanks
    0
    Thanked 1 Time in 1 Post
    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:
    Code:
    <?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.

  • Users who have thanked luckyfella73 for this post:

    WorldVision (05-13-2009)

  • #3
    hkp
    hkp is offline
    New Coder
    Join Date
    May 2009
    Posts
    11
    Thanks
    0
    Thanked 1 Time in 1 Post
    you can take help form this link. hope this link is very helpful for you.

    http://mrarrowhead.com/php_tutorials..._variables.php

  • Users who have thanked hkp for this post:

    WorldVision (05-13-2009)

  • #4
    New Coder
    Join Date
    Dec 2008
    Posts
    33
    Thanks
    17
    Thanked 0 Times in 0 Posts
    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?

  • #5
    Regular Coder mOrloff's Avatar
    Join Date
    Nov 2008
    Location
    The Great Pacific NW, USA
    Posts
    424
    Thanks
    8
    Thanked 6 Times in 6 Posts
    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

  • Users who have thanked mOrloff for this post:

    WorldVision (05-13-2009)

  • #6
    New Coder
    Join Date
    Dec 2008
    Posts
    33
    Thanks
    17
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mOrloff View Post
    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.

  • #7
    Regular Coder sea4me's Avatar
    Join Date
    Jan 2009
    Location
    Damn, I don't know...
    Posts
    390
    Thanks
    11
    Thanked 28 Times in 27 Posts
    ya that is how u make a php file.

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

  • #8
    New to the CF scene
    Join Date
    May 2009
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There are many ways to run .html as .php

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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •