473,395 Members | 1,763 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,395 software developers and data experts.

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

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

if ($_POST['hasReviewedApplicant']) echo $_POST['school_type_other'];
else echo str_replace('"', '&quot;', str_replace('\\', '',
$result[0]->school_type_other));

?>">
[/PHP]

I verified via both var_dump() and print_r() that
$_POST['hasReviewedApplicant'] = 1 and that $_POST['school_type_other']
= 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 5196
comp.lang.php wrote:
I verified via both var_dump() and print_r() that
$_POST['hasReviewedApplicant'] = 1 and that
$_POST['school_type_other'] = 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['hasReviewedApplicant'] = 1 and that
$_POST['school_type_other'] = 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_other 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_other'] even though I
entered it!

Phil

Mar 20 '06 #3
comp.lang.php wrote:
I did just that.. school_type_other 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_other'] 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_type_other" size="30" maxlength="75"
value="<?php

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

if ($_POST['hasReviewedApplicant']) echo $_POST['school_type_other'];
else echo
htmlentities(stripslashes($result[0]->school_type_other),ENT_QUOTES);

Does the same thing,

?>">
[/PHP]

I verified via both var_dump() and print_r() that
$_POST['hasReviewedApplicant'] = 1 and that $_POST['school_type_other']
= 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_type_other" size="30" maxlength="75"
value="<?php

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

if ($_POST['hasReviewedApplicant']) echo $_POST['school_type_other'];
else echo
htmlentities(stripslashes($result[0]->school_type_other),ENT_QUOTES);

Does the same thing,

?>">
[/PHP]

I verified via both var_dump() and print_r() that
$_POST['hasReviewedApplicant'] = 1 and that $_POST['school_type_other']
= 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_other'] 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*******@attglobal.net
==================
Mar 21 '06 #9
in article M4******************************@comcast.com, Jerry Stuckle at
js*******@attglobal.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
Message-ID: <C0***************@karma-lab.nospam.com> from Stephen Kay
contained the following:
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?


That's not php it's html

<a href='newpage.php' target='_blank'>link to new page (opens in a new
window)</a>

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Mar 21 '06 #11
in article 5i********************************@4ax.com, Geoff Berrow at
bl******@ckdog.co.uk wrote on 3/21/06 2:40 PM:
Message-ID: <C0***************@karma-lab.nospam.com> from Stephen Kay
contained the following:
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?


That's not php it's html

<a href='newpage.php' target='_blank'>link to new page (opens in a new
window)</a>


That's not what I meant, sorry.

Maybe I don't have a clue yet, but I wrote a php function that you call from
a button. It takes a bunch of parameters, and assembles them into a URL
string.

Now that I have the URL string (inside my php function), how do I call that
URL and get that page to open up in a window?
--
Stephen Kay
Karma-Lab sk@karma-lab.NOSPAM.com
^^^^^^^
Mar 21 '06 #12
Message-ID: <C0***************@karma-lab.nospam.com> from Stephen Kay
contained the following:
<a href='newpage.php' target='_blank'>link to new page (opens in a new
window)</a>


That's not what I meant, sorry.

Maybe I don't have a clue yet, but I wrote a php function that you call from
a button. It takes a bunch of parameters, and assembles them into a URL
string.

Now that I have the URL string (inside my php function), how do I call that
URL and get that page to open up in a window?


I /think/ you'd probably have to use PHP to output some Javascript to do
that.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Mar 21 '06 #13
in article 4e********************************@4ax.com, Geoff Berrow at
bl******@ckdog.co.uk wrote on 3/21/06 5:10 PM:
Now that I have the URL string (inside my php function), how do I call that
URL and get that page to open up in a window?


I /think/ you'd probably have to use PHP to output some Javascript to do
that.


Thanks for the reply.

I've since discovered curl for at least getting the page to display:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.eample.com");
curl_exec ($ch);
--
Stephen Kay
Karma-Lab sk@karma-lab.NOSPAM.com
^^^^^^^
Mar 21 '06 #14

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

Similar topics

1
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: ...
5
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
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? ...
7
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...
5
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)...
10
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...
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....
2
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,...
32
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...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.