Click to See Complete Forum and Search --> : Apache+php


mush
07-10-2004, 02:45 PM
hi, I'm new for the Apache web server.
im trying to use php with Apache on the same computer. But there is some strange configration problem.
Every thing is going fine ,but when i send the form to the server with the help of the form's post method,then it doesn't return any thing .
e.g

<FORM METHOD=POST ACTION="mush.php" name="mush" >
<INPUT type=hidden value=en name=hl>
<INPUT type=submit value=Search name=btnG>
</FORM>

when i try to check it by

isset($h1)

then i realise that it doesn't set. I tried to use many elements of the forms but i couldn't get any value of the form element.

so what should i do know ?

thanks a lot

rachel2004
07-10-2004, 02:58 PM
Try it with quotes around your values:

<form method="post"

etc.

Also, if register_globals = OFF, you won't see anything with the way you have it coded.

Try this:

if (isset($_POST['h1']))
{
// do something
}

mush
07-10-2004, 03:04 PM
i have used the double quotes And try to chane the phpini file but still facing the same problem :(

rachel2004
07-10-2004, 03:11 PM
What is register_globals set to in your php.ini now that you've changed it? Also, please post some of your code.

mush
07-10-2004, 03:28 PM
In phi.ini file

register_globals = on

and

code of my test script is given below

<html>
<head>
</head>
<body>
<?php
if(!isset($h1))
{
?>
<FORM METHOD="POST" ACTION="mush.php" name="mush">
<INPUT type=hidden value=en name=hl>
<INPUT type=submit value=Search name=btnG>
</FORM>
<?
}
else
{
echo "hello1";
}
if (isset($_POST['h1']))
{
echo "hello2";
}

?>
</body>
</html>

rachel2004
07-10-2004, 03:33 PM
If you have register_globals = on (not recommended), this should work:

<html>
<head>
</head>
<body>
<?php
if(!isset($h1))
{

echo '<FORM METHOD="POST" ACTION="mush.php" name="mush">';
echo '<INPUT type="hidden" value="en" name="hl">';
echo '<INPUT type="submit" value="Search" name="btnG">';
echo '</FORM>';
}
else
{
echo "hello1";
}
?>
</body>
</html>

mush
07-10-2004, 03:42 PM
i think so ,there is some thing wrong with the configration of my webserver :(
is there any other solution ?

rachel2004
07-10-2004, 04:13 PM
I couldn't tell you without knowing why you think there is a configuration problem. Remember, I can't see what you're looking at. You have to desribe the problems.

hearn
07-11-2004, 03:30 AM
Just by chance try using empty instead of isset

So your code would be something like


if (!empty($h1)) {
echo $h1;
}


That is also considering that Register_globals is on, which it sounds like it is.

tsinka
07-11-2004, 04:37 AM
Hi,

it seems like a typo, the name of the input is hl and you check for h1 (one).

Might this be the problem ?

And I'd suggest to use some more " in the form:


<html>
<head>
</head>
<body>
<?php
if(!isset($_POST["hl"]))
{
?>
<FORM METHOD="POST" ACTION="mush.php" name="mush">
<INPUT type="hidden" value="en" name="hl">
<INPUT type="submit" value="Search" name="btnG">
</FORM>
<?
}
else
{
echo "hello1";
}

if (isset($_POST['hl']))
{
echo "hello2";
}

?>
</body>
</html>


Thomas