• Resolved ljvx

    (@loothi)


    Hiya,

    Newbie here, I have a newsletter registration page which needs to show the right message depending upon parameters called.

    i.e.

    http://www.mydomain/wp/newsletter/?error=0
    CASE 1:
    Success for registering!

    http://www.mydomain/wp/newsletter/?error=1
    CASE 2:
    We couldn’t register you.

    The newsletter page (a “Page” with custom PHP template) does not recognise the parameters.

    Test code in the template is

    <? if ($_GET[‘error’]==1) {
    echo ‘ERROR TRUE’;
    } else {
    echo ‘ERROR FALSE’;
    } ?>

    and ‘ERROR FALSE’ always shows.

    Am I doing something dumb? Any ideas?

    TIA.

Viewing 4 replies - 1 through 4 (of 4 total)
  • obviously the $GET isnt being set.

    <?php
    $mything = ( empty( $_GET['error'] ) ? '' : $_GET['error'] );
    if ($mything == 1)
    {
    echo 'ERROR TRUE'; }
    else {
    echo 'ERROR FALSE';
    } ?>

    try that, it works for me.
    `

    Thread Starter ljvx

    (@loothi)

    Do you have pretty permalinks on (Apache/mod_rewrite)?

    Thread Starter ljvx

    (@loothi)

    Odd. Works if param is called errorz but not error. Oh well, works now, thanks.

    error might be an internal variable of some kind to PHP, dunno.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Passing a parameter to a WordPress page’ is closed to new replies.