Web Hosting Talk







View Full Version : PHP, doesnt send variables from the forms ... HELP


Volodya
07-26-2004, 01:23 AM
ANYBODY .... HELP ME ,..., REDHAT9 and PHP
Why my PHP doesnt send variables from the <input> fields???
I have the linux, I think the most problematic one ....RedHat Linux 9 Shrike ........
I dont know, what`s the problem.
I write a simple *.htm page that contains the minimal.
/************* index.html***************/
<html>
<form action="next.php">
Login:
// here I use any method, POST or GET ... no use.
<p><input type = text name = "login" method="post"></p>
<p><input type = submit></p>
</form>
</html>
/**************** next.php********************/
<?php
echo $login;
//HERE NOTHING PRINTS ,..., EMPTY ,...,
//however, the URL is set with the variables, and their values.
//I think it simply wont send the variables.. WHY????
//if it must be configured in conf files, please tell me. //or I`ll think this RH9 sucks .....
?>

Burhan
07-26-2004, 03:36 AM
Read http://www.php.net/register_globals

Learn to use $_GET and $_POST

DanH
07-26-2004, 05:34 AM
Originally posted by fyrestrtr
Read http://www.php.net/register_globals

Learn to use $_GET and $_POST

Try this....



<?php

$login=$_POST['login'];

echo $login;

?>

SeņorAmor
07-26-2004, 09:40 AM
Yeah, I'm pretty sure you want that "method='post'" in your <form> tag and not your <input> tag.

*Edit*
Also surround your types with quotes.

<input type="text" ... />
<input type="submit" />

robertson
07-26-2004, 09:45 AM
Hi,

There is another way to make form variables global ..even when register_global is off....try it...
<?

foreach($_POST as $a=>$b)
{
$$a=trim(stripslashes($b));
}

similarly for $_GET you can do....add at the top of script which processes the form...

Regards
Krishnendu

Rich2k
07-26-2004, 09:52 AM
What a waste of memory resources though?

Burhan
07-26-2004, 10:02 AM
Originally posted by robertson
Hi,

There is another way to make form variables global ..even when register_global is off....try it...
<?

foreach($_POST as $a=>$b)
{
$$a=trim(stripslashes($b));
}

similarly for $_GET you can do....add at the top of script which processes the form...

Regards
Krishnendu

Ever heard of http://www.php.net/extract ? :D

robertson
07-26-2004, 10:26 AM
Originally posted by fyrestrtr
Ever heard of http://www.php.net/extract ? :D

Hi,
Yeah...but I also faced the same situation as the other guy did...please read the notes below extract(http://www.php.net/extract)...while extracting values of $_POST, $_GET....read the post by mina86 at tlen dot pl

Kindest Regards
Krishnendu

Burhan
07-26-2004, 10:56 AM
Well even your solution has the same issues. It just best to use $_POST and $_GET directly.

stormraven
07-26-2004, 11:05 AM
or..

import_request_variables() ?