Passing variables

  • Unknown's avatar

    Hi,

    I am using the GET Variable to ask the user to input their name into a text box on one page and output it to another page as a personalised welcome message.

    This is the code for both of my pages:

    Input Page:

    <html>
    <body>
    <form action=”message” method=”get”>
    <b>Enter your name : </b> <input type=”text” name=”user”>
    <input type=”submit”>
    </form>
    </body>
    </html>

    Message Page:

    <?php
    $name = $_GET[‘name’];
    echo ‘Welcome to the site ‘ . $name . ‘.’;
    ?>

    But it returns Page not found.

    I can do the same coding, within php files on my server and it works. The only differences I have is I am calling the message page into the index.php using <?php get_message(); ?> and the from action I have left as message instead of message.php. I also installed a plugin to allow php to be used within the WordPress pages. I think I need to call the <?php get_message(); ?> again somewhere but really not sure.

    How do I get the input page to collect the name from the user and post it on the message page as a welcome?

    Thanks in advance for advice.

    Kay

  • You didn’t provide a URL, but it sounds like you want help with a WordPress.ORG website. This support forum is only for free WordPress.COM blogs. WordPress.com and WordPress.org are completely separate and different: http://en.support.wordpress.com/com-vs-org/

    Please visit the WordPress.org support forum for assistance as we won’t be able to help you here: http://wordpress.org/support/ If you don’t already have a username on that forum, click the register button in the upper right corner so you can post in that forum.

  • The topic ‘Passing variables’ is closed to new replies.