Passing variables in URL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
ZieST
Forum Newbie
Posts: 2
Joined: Thu Jan 30, 2003 12:13 pm

Passing variables in URL

Post by ZieST »

Hi,

When i run the following php script on my local machine it doesn't pass the variables in the URL but it will do it on my server. I am currently running Apache and mySQL locally.

<html>
<head>
<title>Dev Page</title>
</head>
<body>
<font face="Arial" size=2>
<?php
if(isset($add)) { // if the user wants to add a joke
?>

<form action="index.php" method="POST">
<p>Type your text here:<br>
<textarea name="text" rows="10" cols="40" wrap></textarea><br>
<input type="submit" name="submit_text" value="SUBMIT"/>
</p>
</form>

<?php
} else { // default page display
echo ("<p><a href='index.php?add=1'>Add some text</a></p>");
}
?>
</font>
</body>
</html>


Could anyone tell me why this is happening?

Thanks
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post by daven »

I am unsure if I am reading your question correctly.
1. If you are asking hot to have form variables appeneded to the URL: <form action="action" method="GET">.
To have them pass invisibly, set <form action="action" method="POST">.

2. If you are asking why your form will not work on your local machine, even though it works on your sever, check your php settings.
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

this is a duplicate topic. im locking it and if you wish to follow it then continue here: viewtopic.php?t=6079
Locked