Jump to content

Recommended Posts

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

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>

 

 

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.