joave Posted May 29, 2007 Share Posted May 29, 2007 Hi: I am trying to pass variables from a html form to a php form. I am using IIS as a server on XP Pro and find that relative links are not working (see explanation below), but a fully qualified link (http://localhost/weblink.php) does work. If the relative link is used, the browser opens up the PHP page as code and does not execute the code. Is this a IIS problem, or a configuration problem, and where might the problem be? Thank you in advance, Dave Quote Link to comment https://forums.phpfreaks.com/topic/53339-relative-links-from-html-page-to-php-page-dont-work-locally/ Share on other sites More sharing options...
snowdog Posted May 29, 2007 Share Posted May 29, 2007 can we see the code please. Snowdog Quote Link to comment https://forums.phpfreaks.com/topic/53339-relative-links-from-html-page-to-php-page-dont-work-locally/#findComment-263609 Share on other sites More sharing options...
joave Posted May 29, 2007 Author Share Posted May 29, 2007 Here is the code with the fully qualified link – test.htm: <html> <form action="http://localhost/welcome.php" method="request"> <label>First Name: <input type="text" name="firstname" /> </label><br/> <label>Last Name: <input type="text" name="lastname" /> </label><br/> <input type="submit" value="GO" /> </form> </html> And with a relative link: <html> <form action="welcome.php" method="request"> <label>First Name: <input type="text" name="firstname" /> </label><br/> <label>Last Name: <input type="text" name="lastname" /> </label><br/> <input type="submit" value="GO" /> </form> </html> And here is welcome.php: <html> <?php $firstname=$_REQUEST['firstname']; $lastname=$_REQUEST['lastname']; if ($lastname == 'Glick' and $firstname == 'Dave'){ echo "Welcome, oh glorious leader, $lastname!"; }else{ echo "Welcome to our website, $firstname $lastname!"; } ?> </html> Quote Link to comment https://forums.phpfreaks.com/topic/53339-relative-links-from-html-page-to-php-page-dont-work-locally/#findComment-263626 Share on other sites More sharing options...
snowdog Posted May 29, 2007 Share Posted May 29, 2007 change this line: if($lastname == 'glick' and $firstname == 'Dave'){ to this line: if($lastname == "glick" && $firstname == "Dave"){ Quote Link to comment https://forums.phpfreaks.com/topic/53339-relative-links-from-html-page-to-php-page-dont-work-locally/#findComment-263636 Share on other sites More sharing options...
joave Posted May 29, 2007 Author Share Posted May 29, 2007 Hi snowdog: No I am sorry but that isn't the problem - the code still shows up, unexecuted. When opening the test.htm page first, and putting the names in the text boxes and clicking Go, the browser wants to 'open' the php page to display the code. It doesn't want to execute it unless I use the fully qualified link. Can we keep going? Thank you! Dave Quote Link to comment https://forums.phpfreaks.com/topic/53339-relative-links-from-html-page-to-php-page-dont-work-locally/#findComment-263697 Share on other sites More sharing options...
snowdog Posted May 29, 2007 Share Posted May 29, 2007 Ok I looked a little closer and I dont think you can use in your form method "REQUEST", I thought there was only "POST" and "GET" and in this case you would want post to send the form data to the processing agent. Also the "and" in your if statement needs to be && to make that logic work from my experience. Snowdog Quote Link to comment https://forums.phpfreaks.com/topic/53339-relative-links-from-html-page-to-php-page-dont-work-locally/#findComment-263884 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.