473,756 Members | 3,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

$_POST value is set but always = null even if you enter something

[PHP]
Other: <input name="school_ty pe_other" size="30" maxlength="75"
value="<?php

if ($_POST['hasReviewedApp licant']) echo $_POST['school_type_ot her'];
else echo str_replace('"' , '&quot;', str_replace('\\ ', '',
$result[0]->school_type_ot her));

?>">
[/PHP]

I verified via both var_dump() and print_r() that
$_POST['hasReviewedApp licant'] = 1 and that $_POST['school_type_ot her']
= null, even when you enter something into the text field, it's still
null!

Can someone tell me what on earth I did wrong this time? I'm lost here!

Thanx
Phil

Mar 20 '06 #1
13 5218
comp.lang.php wrote:
I verified via both var_dump() and print_r() that
$_POST['hasReviewedApp licant'] = 1 and that
$_POST['school_type_ot her'] = null, even when you enter something
into the text field, it's still null!


You need to specify the type of the element (type="text").
JW
Mar 20 '06 #2

Janwillem Borleffs wrote:
comp.lang.php wrote:
I verified via both var_dump() and print_r() that
$_POST['hasReviewedApp licant'] = 1 and that
$_POST['school_type_ot her'] = null, even when you enter something
into the text field, it's still null!


You need to specify the type of the element (type="text").
JW


I did just that.. school_type_oth er is type="text", which in HTML is
never a requirement, in fact, before I tried that none of the other
HTML form element text field tags have type="text" and work just fine.
I added type="text", still no $_POST['school_type_ot her'] even though I
entered it!

Phil

Mar 20 '06 #3
comp.lang.php wrote:
I did just that.. school_type_oth er is type="text", which in HTML is
never a requirement, in fact, before I tried that none of the other
HTML form element text field tags have type="text" and work just fine.
I added type="text", still no $_POST['school_type_ot her'] even though
I entered it!


Can you post the element after the values are parsed in it by PHP?
JW
Mar 20 '06 #4
comp.lang.php wrote:
[PHP]
Other: <input name="school_ty pe_other" size="30" maxlength="75"
value="<?php

if ($_POST['hasReviewedApp licant']) echo $_POST['school_type_ot her'];
else echo str_replace('"' , '&quot;', str_replace('\\ ', '',
$result[0]->school_type_ot her));
Just curious... why are you doing this when

if ($_POST['hasReviewedApp licant']) echo $_POST['school_type_ot her'];
else echo
htmlentities(st ripslashes($res ult[0]->school_type_ot her),ENT_QUOTES );

Does the same thing,

?>">
[/PHP]

I verified via both var_dump() and print_r() that
$_POST['hasReviewedApp licant'] = 1 and that $_POST['school_type_ot her']
= null, even when you enter something into the text field, it's still
null!


Please post the code for the whole form.

Also, when you first enter the processing script, what does:
<?php echo '<pre>' . print_r($_POST, true) . '</pre>'; ?>
display on the screen?

Ken

Mar 20 '06 #5

Ken Robinson wrote:
comp.lang.php wrote:
[PHP]
Other: <input name="school_ty pe_other" size="30" maxlength="75"
value="<?php

if ($_POST['hasReviewedApp licant']) echo $_POST['school_type_ot her'];
else echo str_replace('"' , '&quot;', str_replace('\\ ', '',
$result[0]->school_type_ot her));
Just curious... why are you doing this when

if ($_POST['hasReviewedApp licant']) echo $_POST['school_type_ot her'];
else echo
htmlentities(st ripslashes($res ult[0]->school_type_ot her),ENT_QUOTES );

Does the same thing,

?>">
[/PHP]

I verified via both var_dump() and print_r() that
$_POST['hasReviewedApp licant'] = 1 and that $_POST['school_type_ot her']
= null, even when you enter something into the text field, it's still
null!


Please post the code for the whole form.


Even if I were allowed to do so - which I'm not as it is fed gov't
property and even posting code is considered a federal no-no, it's over
3,000 lines long, sorry :(

And if it gets weirder I can't duplicate the error, even after several
tries, $_POST['school_type_ot her'] now exists.

Phil
Also, when you first enter the processing script, what does:
<?php echo '<pre>' . print_r($_POST, true) . '</pre>'; ?>
display on the screen?

Ken


Mar 21 '06 #6
learning php here - I'm echoing some debug code, and I cannot seem to make
the newline character work.

For example, I tried this:

echo "supposedly , this will \nbe on \nmultiple lines.";

which, according to the php manual, should produce this:

supposedly, this will
be on
multiple lines.

But it doesn't work! It's all on the same line. What obvious thing am I
missing?

--
Stephen Kay
Karma-Lab sk@karma-lab.NOSPAM.com
^^^^^^^
Mar 21 '06 #7
Sorry for this really basic question, but assuming you have created a URL
string in your code, how do you cause a window to be opened with that url?

I've been searching the manual, but haven't found it yet.

I've seen reference to CURL libraries, but that seems a bit complicated for
the simple thing I'm trying at the moment. Thanks!
--
Stephen Kay
Karma-Lab sk@karma-lab.NOSPAM.com
^^^^^^^
Mar 21 '06 #8
Stephen Kay wrote:
learning php here - I'm echoing some debug code, and I cannot seem to make
the newline character work.

For example, I tried this:

echo "supposedly , this will \nbe on \nmultiple lines.";

which, according to the php manual, should produce this:

supposedly, this will
be on
multiple lines.

But it doesn't work! It's all on the same line. What obvious thing am I
missing?


Display your html source. You'll see the newlines there.

This isn't a PHP problem - it's how HTML works. Newline characters are
ignored. Instead, you need to use <br> to start a new line.
See the nl2br() function.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Mar 21 '06 #9
in article M4************* *************** **@comcast.com, Jerry Stuckle at
js*******@attgl obal.net wrote on 3/21/06 2:08 PM:
This isn't a PHP problem - it's how HTML works. Newline characters are
ignored. Instead, you need to use <br> to start a new line.
See the nl2br() function.


Thanks - I didn't think of looking at the source instead of the screen
output. Makes total sense. I've got it doing what I want now.

--
Stephen Kay
Karma-Lab sk@karma-lab.NOSPAM.com
^^^^^^^
Mar 21 '06 #10

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

Similar topics

1
3167
by: Raptor | last post by:
I'm using a single script to generate a table with <input>s in each row. I fill the array with initial values, then write it out to the table and let the user edit the values. Something like: $myarray = $array(1, 2, 3, ... 100); echo 'Enter your changes, then click Submit:'; foreach ($array as $i) echo '<table tags> <input value="'.$i.'" name="index.'$i.'"> <table tags>';
5
1438
by: Collie | last post by:
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;
1
6994
by: RDizzle | last post by:
okay. so all i am doing is changing a registration script that uses $_GET to a script that uses $_POST, but the validation script now returns NULL values for all posted vars. What's the deal? NOTE: when i use $_GET the script just works. Thanks in advance for helping a noob.
7
11487
by: tlyczko | last post by:
I have a char(11) for SSN, and I would like to default it to 123-45-6789 so I can avoid having nulls in this column, and so I can easily find the rows in which I need to have a 'correct' SSN entered/updated. I tried using just 123-45-6789, and SQL2005 doesn't seem to be defaulting to this value, it seems to be keeping it as (((123)-(45))-(6789), and not placing it into this column when a new row is created....
5
2298
by: comp.lang.php | last post by:
// NEW 11/27/2006: FINALLY, IF YOU ADDED OR DELETED OR DID ANY KIND OF FORM ACTION SUCCESSFULLY, DON'T RE-DISPLAY THE NEW EXPENSE ITEMS VIA $_POST if ($_POST && (!is_array($leaseObj->errorArray) || @sizeof($leaseObj->errorArray) == 0)) { print_r(array_keys($_POST)); @reset($_POST); $tempPost = $_POST; foreach ($_POST as $key =$val) if (strpos($key, 'new_') === 0) array_remove($tempPost, $tempPost);
10
2759
by: sufian | last post by:
I am new to the world of PHP. Below is my simple PHP file "invite.php" with a form having an image send button (I have to use the image send button because it is the requirement, may be this is causing problem!): <html> <head><title>Form</title> </head> <body> <script language="javascript" src="validation.js"></script> <form action="submit.php" method="POST"> <table border ="0" align="center" cellpadding="9"...
12
2663
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"
2
3140
by: keeps21 | last post by:
I have a script that recieves an id number via the address bar when a link is clicked. ie . index.php?id=1 if the link was for the story whose ID is 1. My script checks if a user is logged in, if not they are redirected to the login page. If logged in they may edit the story. I assign $_GET to $id.
32
8202
by: Bill H | last post by:
I wouldn't consider myself a newbie to PHP since I have never written one line of code in it (am a perl guy myself), but part of a team I am working with is writing some php interfaces into a database and I noticed that they are relaying on HTML form value names to always be lowercase in their code (ie $_POST (fyi that may be typed wrong)) and from my experience it is always better, when reading in the post information to convert the the...
0
9456
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
9275
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
10034
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
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
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
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.