469,963 Members | 1,933 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

$_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 4936
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Raptor | last post: by
5 posts views Thread by Collie | last post: by
5 posts views Thread by comp.lang.php | last post: by
12 posts views Thread by Todd Michels | last post: by
32 posts views Thread by Bill H | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.