I'm new to PHP.I'm trying to do something very simple,I have tried to search on google but still i'm not understanding why its not working. I'm trying to send information through a url, and having a script pick it up using the $_GET super global.

This is FORM.php script:

<form action="home.php" method="get"> Email:<input type="text" name="email"/> </form>

This is the home.php script:

<?php echo $_GET['email']; ?>

This yields a blank page.but URL is displaying that email has been sent. Thanks for taking the time to read through this!Any help will be appreciated.

Recommended Answers

All 10 Replies

It's seems fine to me.
In php.ini there is a directive that permits to disable GET, check for variables_order in: http://php.net/manual/en/ini.core.php if G is not present then you have to edit the configuration and reload the server. Bye.

Member Avatar for diafol

try

print_r($_GET)

If it's empty, you should see Array().
Otherwise all url parameters and values should be shown.

<form action="home.php" method="get"> Email:<input type="text" name="email"/> </form>

also try adding id="email"

<form action="home.php" method="get"> Email:<input type="text" name="email" id="email"/> </form>

Member Avatar for diafol

also try adding id="email"

That's not impt for form field submission. Useful for js/css though.

Actually your code is allright.

You should try the print_r($_GET) as diafol said

echo '<pre>'.print_r($_GET).'</pre>';

yes.its displaying url parameter and their values.

but still
echo $_GET['email'];
is not working.

when try this code with post , even that also not working.

so try adding id="email"

When i add id="email" its now working..Thank you!!

Member Avatar for diafol

bizarre!

Try it with echo $_REQUEST["email"];

I'm getting it right even without 'id'...Don't know how it is possible for mits28 to get it only with 'id'?

Hey, Squidge can u explain why u suggested 'id'?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.