• Resolved WPChina

    (@wordpresschina)


    I was using RunPHP plugin until recently and now switched to Insert PHP. Works well except in one situation: I want to pass a variable value called “email” to a form. It works in PHP, but when I try he Insert PHP it doesn’t appear to be passed. Below is the code I use:

    <input name="email" type="text" id="email" value="[insert_php] print stripslashes(urldecode($_GET["email"])); [/insert_php]">

    https://ww.wp.xz.cn/plugins/insert-php/

Viewing 2 replies - 1 through 2 (of 2 total)
  • The variable $_GET[“email”] must be set for it to print. If the page with the form is loaded with an email parameter, like

    http://example.com/[email protected]

    then [email protected] should print. If it doesn’t, then WordPress is preempting the $_GET array. WordPress tends to do that, especially with “Plain” permalinks.

    $_GET isn’t reliable as a way to transfer data to WordPress posts and pages. You might try a different “Settings->Permalinks” preference to see if one of the other permalink styles let you pass a $_GET variable.

    Will

    Thread Starter WPChina

    (@wordpresschina)

    Ok, interesting…. I re-saved permalinks and now everything works fine. Seems I needed ot do that after instaling the plugin. All seems fine now. Thank you. Resolved 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Problems passing a variable in a form’ is closed to new replies.