GET Variable
-
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 being 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
The topic ‘GET Variable’ is closed to new replies.