/    Sign up×
Community /Pin to ProfileBookmark

UPgrade to php 5.5 causes null values to be passed from value= clause

My web hosting site has been upgrading us from php 5.2 to php 5.5 or 5.6. Over the weekend after being upgraded to 5.5 I noticed most of my php programs had failed to process due to the fact that the “value=” clause of the <input tag was passing nulls instead of the specified values. I have a ticket open with the hosting site but I was wondering if anyone encountered this type of issue. Below is a sample of the html I’m using followed by some php code. THanks in advance for any help.

HTML:

<SCRIPT SRC=”http://insight_/http://www.ipower.com/controlpanel/FileManager/m.cmp?cmd=getfile&p=public_html% 2Findex.html/ins.js”></SCRIPT>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd“>
<html xmlns=”http://www.w3.org/1999/xhtml“>

<input type=”radio” value=”status.php” id=”sub1″ name=”sub” checked=”checked” /><label
for=”sub1″>&nbsp;Display Current Weekly Pool Standings</label>
<input type=”hidden” name=”week” length=2 maxlength=2 value=’04’ readonly

PHP:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd“>
<html xmlns=”http://www.w3.org/1999/xhtml“>

@ $db = mysql_connect(‘weknowth.ipowermysql.com’,’xxxxx’,’yyyyyy’);

$query=”SELECT coverteam1,coverteam2
from game where week='”.$week.”‘”;

The value of week should have been passed as ’04’ instead it was a null value.

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@NogDogOct 06.2015 — The value should be in $_GET['week'] or $_POST['week'], depending on what method your form used -- though I don't see a <form> tag anywhere to tell me? If you are depending on PHP to automatically create and populate the $week variable, then you are depending on the register_globals feature/option, which has been deprecated for many years as a security risk, and finally completely removed as of PHP 5.4.8.
Copy linkTweet thisAlerts:
@rfintzauthorOct 06.2015 — The issue re-occurred last night, however this time it was on the older php release (5.2). I spoke with someone at my web hosting site who felt it was a problem with the php.ini parameter session.save_path not being set correctly. He fixed that and upgraded me to 5.3. Let's see how it goes. Below is the form tag I'm using.

function submitTheForm(oFrm){

for(var i = 0;i < oFrm.sub.length;i++){

if(oFrm.sub[i].checked) {

oFrm.action = oFrm.sub[i].value;

return true





<form action="" method="post" onsubmit="return submitTheForm(this)">

<fieldset>



<input type="submit" value="Submit" />
</fieldset>
Copy linkTweet thisAlerts:
@ginerjmOct 06.2015 — Why do you insist on posting incomplete and confusing pieces of code? First it was two input elements but no form. Now it's a JS function with no end and poor logic. And you give us a START of a form but no input elements and no END of the form.

Is this truly how you code or just a test to see if forum readers are that gullible?

If you want help you must post what you are working with so that we can see what is in front of you. NOT your whole script but at the least the parts that are part of your dilemma.
Copy linkTweet thisAlerts:
@rfintzauthorOct 06.2015 — I apologize, I'm an amateur at this and had help developing it. It's definitely not a test for gullibility, just ignorance on my part.

I'm posting a majority of the html I'm using:

<SCRIPT SRC="http://insight_/http://www.ipower.com/controlpanel/FileManager/m.cmp?cmd=getfile&p=public_html%2Findex.html/ins.js"></SCRIPT>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>selections for this week </title>

<script type="text/javascript">

//<![CDATA[

function submitTheForm(oFrm){

for(var i = 0;i < oFrm.sub.length;i++){

if(oFrm.sub[i].checked) {

oFrm.action = oFrm.sub[i].value;

return true

}

}

}

//]]>

</script>

<style type="text/css">

/*<![CDATA[*/

h1 {font-size: 16pt; font-style: italic }

/*]]>*/

</style>

</head>

<body>

<h1>

Welcome to http://www.weknowthenfl.com

</h1>

<p>

Make your selection from one of the options below and

click submit at the bottom of the box.

</p>

<form action="" method="post" onsubmit="return submitTheForm(this)">

<fieldset>



<input type="radio" value="display.php" id="sub0" name="sub" checked="checked" /><label for="sub0">&nbsp;Display this week's Player's Picks</label>

<input type="hidden" name="week" length=2 maxlength=2 value='04' readonly style="width:20px; font-family:

arial,sans-serif; font-size:14px"/>

<br />

<br />



<input type="radio" value="status.php" id="sub1" name="sub" checked="checked" /><label

for="sub1">&nbsp;Display Current Weekly Pool Standings</label>

<input type="hidden" name="week" length=2 maxlength=2 value='04' readonly style="width:20px; font-family:

arial,sans-serif; font-size:14px"/>

<br />

<br />

<input type="radio" value="build_forum.php" id="sub3" name="sub" /><label for="sub3">&nbsp;Head to the football forum</label>

<br />

<br />



<P>

<input type="submit" value="Submit" />

</fieldset>

</font

</form>

</body>

</html>
Copy linkTweet thisAlerts:
@ginerjmOct 06.2015 — What a piece of work!! Whoever helped you with this is quite behind the times.

You are using some very complex stuff to do what is essentially a simple thing.

1 - problem. You can't "check" all 3 radio buttons. That's the whole concept behind radio buttons - you can only select ONE! If you want to select multiple things you use a - check box!

2 - Stop repeating the css stuff in each element. You use a css block in your html code to do that for you.

3 - Stop using the font tag as a stand-alone tag. Besides - you only have an 'end' font tag and no beginning one, so you're half right.

Here's how I would tackle this:
[code=php]
<?php
session_start();
// ALWAYS TURN ON ERROR CHECKING DURING DEVELOPMENT!!!
error_reporting(E_ALL | E_NOTICE);
ini_set('display_errors', '1');
//*****************************
// if no submitted 'btn' tag, just display the selection menu
if (!isset($_POST['btn']))
{
DisplayPage();
exit();
}
// got a submitted btn - grab it and analyze it.
$btn = $_POST['btn'];
//*****************************
if ($btn == "Display this week's Player's Picks")
{
// jump to display.php
header("Location: display.php");
exit();
}
//*****************************
if ($btn == 'Display Current Weekly Pool Standings')
{
// jump to status.php
header("Location: status.php");
exit();
}
//*****************************
if ($btn == 'Head to the football forum')
{
// jump to build_forum.php
header("Location: build_forum.php");
exit();
}
//*****************************
// handle an undefined button
echo "Unhandled button name - $btn";
exit();
//*****************************
function DisplayPage()
{
$code=<<<heredocs
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>selections for this week</title>
<style type="text/css">
body,input
{
font-family:arial,sans-serif;
font-size:14px;
}
h1
{
font-size: 16pt;
font-style: italic;
}
</style>
</head>
<body>
<h1>
Welcome to http://www.weknowthenfl.com
</h1>
<p>
Make your selection from one of the options below and
click submit at the bottom of the box.
</p>
<form action="" method="post">
<input type='hidden' name='week' value='04'>
<input type='submit' name='btn' value="Display this week's Player's Picks">
&nbsp;&nbsp;
<input type='submit' name='btn' value='Display Current Weekly Pool Standings'>
&nbsp;&nbsp;
<input type='submit' name='btn' value='Head to the football forum'>
<br><br>
<input type='submit' name='btn' value='Exit'>
</form>
</body>
</html>
heredocs;
echo $code;
return;
}
[/code]
Copy linkTweet thisAlerts:
@rfintzauthorOct 06.2015 — The development work was done years ago. THanks very much for your help. I'll give it a shot.
×

Success!

Help @rfintz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...