Thread: Cookie to Form

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    1
    Rep Power
    0

    Cookie to Form


    Ok I'm new, and not a PHP person.

    I have a form I'm trying to submit with cookie values or url values. The URL values are going through without a hitch but for some reason the cookie values are only working now and then. For some strange reason.

    see code. note this is in a joomla module hense the script tags.

    <input maxlength="100" name="LEADCF7" type="hidden" value="
    {source}
    <?php
    if($_GET['utm_source'] != ""){
    echo $_GET['utm_source'],' | ', $_GET['utm_medium'];}
    else{
    echo $_COOKIE['tpsource'],' | ', $_COOKIE['tpmedium'];
    }
    ?>
    {/source}
    "/>

    <input type="hidden" maxlength='100' name='LEADCF8' value="
    {source}
    <?php
    if($_GET['utm_source'] != ""){
    echo $_GET['utm_campaign'];}
    else{
    echo $_COOKIE['tpcampaign'];}
    ?>
    {/source}
    "/>
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    7
    Rep Power
    0

    Diagnostics...


    First I would write something into the page to try and diagnose if the problem is with the cookie or returning the value from the cookie.

    Elsewhere in the page you could use something like, isset(); to check if the value of the cookie is set properly. Is the cookie returning a value?

IMN logo majestic logo threadwatch logo seochat tools logo