473,387 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Yet another $_POST Problem

PHP version 5.1.1
Apache 2.0.55.

code;
index.html

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<form action="foo.php" method="post" name="form">
<input name='username' type="text" value="colin">
<input name="email" type="text" value="crona...@email.com">
<input name="submit" type="submit" value="submit me!">
</form>
</body>
</html>

foo.php

<?php
echo "We are on foo.php";
echo "<br>";
$username = isset($_POST['username']) ? $_POST['username'] :
NULL;
$email = isset($_POST['email']) ? $_POST['email'] : NULL;
echo $username;
echo $email;
?>

Output;
We are on foo.php

So simple. So easy. Yet $username and $email will not get printed.

All my forms worked perfectly last week (boo-hoo, I know), but now only
GET will work on even the simplest of forms. And I would rather not go
through every form and change them to get.

Cause it's past midnight on my second day of trying to fix this I have
to ask.......
Any ideas?
Did I change a php.ini setting in my sleep?

/* It can take hours to find the problem and a second to fix it. */

Dec 6 '05 #1
5 1416
Try a

print_r($_POST);

and see what you get. If nothing, then NULLs will be assigned as per
your code. This also probably points to a php.ini or other PHP or
Apache setting that is preventing POST variables, because AFAICT, you
code appears to be correct.
Mark
Dec 6 '05 #2
cheers Mark.

I have tried that allright. For GET it populates the Array but for
POST the array is empty.
Once I got all my text forms working correctly I moved onto file
upload. The only thing I can remember changing is the maximum file
size allowed in php.ini. But the fact that it worked and now doesn't
means I changed something else. But I can't for the life of me figure
out what it is. Anything specific I should look for? php.ini and
apache config looks fine. But I could be looking through rose tinted
glasses.

Thanks again mate.

Dec 6 '05 #3
Well, I answered my own question.
By changing
post_max_size = 1000000000M to
post_max_size = 100000000M
all post data was sent.

The reason I changed it was that I thought it worked in conjunction
with
upload_max_filesize

but this doesn't seem to be the case. File upload will still upload
files of a gig.

Cool.

Thanks Mark.

Dec 6 '05 #4
>By changing
post_max_size = 1000000000M to
post_max_size = 100000000M
all post data was sent.

The reason I changed it was that I thought it worked in conjunction
with
upload_max_filesize

but this doesn't seem to be the case. File upload will still upload
files of a gig.


Don't you think that 100,000 GIGABYTES is a little excessive for
POST data? Besides, it's apparently taking it as a signed 32-bit
number anyway, and if it's negative, it won't allow any.

Gordon L. Burditt
Dec 6 '05 #5
"Collie" <cr******@gmail.com> wrote in
news:11**********************@f14g2000cwb.googlegr oups.com:
PHP version 5.1.1
Apache 2.0.55.

code;
index.html

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<form action="foo.php" method="post" name="form">
<input name='username' type="text" value="colin">
<input name="email" type="text" value="crona...@email.com">
<input name="submit" type="submit" value="submit me!">
</form>
</body>
</html>

foo.php

<?php
echo "We are on foo.php";
echo "<br>";
$username = isset($_POST['username']) ? $_POST['username'] :
NULL;
$email = isset($_POST['email']) ? $_POST['email'] : NULL;
echo $username;
echo $email;
?>

Output;
We are on foo.php

So simple. So easy. Yet $username and $email will not get printed.

All my forms worked perfectly last week (boo-hoo, I know), but now
only GET will work on even the simplest of forms. And I would
rather not go through every form and change them to get.

Cause it's past midnight on my second day of trying to fix this I
have to ask.......
Any ideas?
Did I change a php.ini setting in my sleep?

/* It can take hours to find the problem and a second to fix it. */


isset is not the function you want to use. Try empty().

--
Stan McCann "Uncle Pirate" http://stanmccann.us/pirate.html
Webmaster/Computer Center Manager, NMSU at Alamogordo
http://alamo.nmsu.edu/ There are 10 kinds of people.
Those that understand binary and those that don't.
Dec 6 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: AJ Z | last post by:
I am using in_array() to search for a value ("other"), in order to validate a form. If I pass $_POST as the array to search PHP says that it is an invalid datatype. It is an array and if I copy...
11
by: Adrian Parker | last post by:
Is it possible to click on a button, and not have it's value and name stored in _POST? I have this script with a button on it. When you click the button, the page posts to itself. The first...
10
by: Jack | last post by:
How would I add a variable that I will assign to a list of $_POST variables that I extract from a form? My form passes a value for $q. That works fine. What I want to do is run an if/else on it...
4
by: Kevin | last post by:
I am having problems in my php code. I am relatively new to php but I know some basics. This is the problem: when i try to echo some information that is typed into form back to the screen i...
7
by: Dan | last post by:
I was trying to troubleshoot a login page that doesn't work - it keeps saying the login/password is missing - when my tracing discovered this peculiar behavior. register_globals is off, so at...
10
by: arun.kumar.varma | last post by:
Hi, I'm learning PHP and prepared a simple login form. validate.php does the validation and it was behaving erratically. So, I did var_dump of $_POST variable and it's NULL. Did I miss anything...
7
by: Dynamo | last post by:
I am using values stored an $_POST array to display records from a table before asking the user if he is sure he wants to delete them. If the user confirms then the records are deleted. Without...
12
by: Todd Michels | last post by:
Hi all, I am trying to send data from a form and insert it into a MSSQL DB. When I submit the data I get: Warning: mssql_query() : message: The name "Todd" is not permitted in this context....
5
Tarantulus
by: Tarantulus | last post by:
Hi, ok, quick description of the problem, I'm trying to reference the postdata from some checkboxes. Unfortunately the checkboxes are dynamically generated therefore I don't know how many there...
10
by: Mason Barge | last post by:
I have a standard POST form consisting of two types of input: text input and textarea. The form downloads current settings from a mysql database. The user can update the information by modifying...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.