473,769 Members | 1,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Yet another $_POST Problem

PHP version 5.1.1
Apache 2.0.55.

code;
index.html

<html>
<head>
<title>Untitl ed 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 1439
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_file size

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_siz e = 1000000000M to
post_max_siz e = 100000000M
all post data was sent.

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

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.goo glegroups.com:
PHP version 5.1.1
Apache 2.0.55.

code;
index.html

<html>
<head>
<title>Untitl ed 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
6012
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 it to another variable (i.e. $list = $_POST;) it works fine. The same is also true of implode(). Do you believe this is intended or is it a bug? --
11
3454
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 time you click this Save Changes button, _POST is empty. After clicking the button, and the page is loaded again, if you click Save Changes once more the _POST is properly set. What's up with that?
10
2669
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 and assign a new variable based on what was chosen such as if ($q == "red") { $q = "tp"; //change $q to this value $sub = "ak"; //attach this value to the $sub variable } else {
4
3496
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 get absolutely nothing. It seems like $_POST is an empty string, along with $_POST and $_GET. I looked around to see if someone else had the same problem and found
7
11879
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 the top of my script I assign a few variables to incoming GET and POST values. $login = clean($_POST, 30); $passwd = clean($_POST, 30);
10
14696
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 here regarding the configuration or code? Code for validate.php is given below. <?php var_dump($_POST);
7
2491
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 boring you with all of the code here is the rough idea. <?php $delete = '( id = ' . implode(' OR id = ', $_POST ) . ' ) '; if (!isset($_POST)) { // Then display the records that were marked for deletion ?>
12
2665
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. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted. (severity 15) in "Myfile"
5
3875
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 are and thus can't name them individually. I remember reading that naming them with square brackets (as "name") will automatically create an array in the postdata (meaning $_POST is an array) is this true? anyway, the fact is that my checkboxes...
10
3015
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 the text and clicking a standard "submit" button. MAIN PROBLEM: My problem is that the information transmitted to the formhandler apparently has some sort of whitespace added to it. If I simply use trim() on the POST variable, it fails the...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10045
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.