THIS PROBLEM IS SOLVED - see below!
By chance I discovered this problem... The beginning and end of my HTML form:
<form name="personform" id="personform" action="testperson.php" method="post" target="_blank">
<input type="hidden" id="formPmall" name = "formPmall" value = "">
<input type="hidden" id="formPCSEsiteHeading" name = "formPCSEsiteHeading" value = "">
<input type="hidden" id="formPCSEsiteHeadingText" name = "formPCSEsiteHeadingText" value = "">
<input type="hidden" id="formPCSEsiteHeadingShadow" name = "formPCSEsiteHeadingShadow" value = "">
<!-- skipping to end of form -->
<input type="hidden" id="formPok" name = "formPok" value = "">
</form>
This is the function I call to set the values and submit the form:
function testaPerson() {
document.getElementById("formPmall").value = vilkenMall;
document.getElementById("formPCSEsiteHeading").value = fAktuellSajtrubrik;
document.getElementById("formPCSEsiteHeadingText").value = CSEsiteHeadingText;
document.getElementById("formPCSEsiteHeadingShadow").value = CSEsiteHeadingShadow;
/* Skipping to end of function */
document.getElementById("formPok").value = "ok";
// SUBMIT
document.getElementById("personform").submit();
}
The function works as I can put a JS alert() like this right before the submit:
alert("PM = *"+document.getElementById("formPmall").value+"*");
and I get the correct answer ("4" not "**" as empty). This works fine for each and every form input.
The form arrives to "testperson.php":
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
if (!isset($_POST['formPok'])) header('Location: ../index.php');
// Init variables
$mall = 0;
$CSEsiteHeading = "#FF00FF";
$CSEsiteHeadingText = "";
$CSEsiteHeadingShadow = "";
// Skipping 60+ variable inits
// Read the form
$mall = $_POST['formPmall'];
$CSEsiteHeading = $_POST['formPCSEsiteHeading'];
$CSEsiteHeadingText = $_POST['formPCSEsiteHeadingText'];
$CSEsiteHeadingShadow = $_POST['formPCSEsiteHeadingShadow'];
// Skipping the rest...
The index ['formPok'] is set because I don't go to "index.php".
The variables have values as I can put a PHP die(); like this after them:
die("PM = *".$mall."*");
and I get the correct answer ("4" - not "0" as initialized or "**" as empty) This works fine for each and every PHP variable.
The final page is also displaying fine.
BUT! I get this in the php_error.log:
[29-Oct-2013 13:30:01 UTC] PHP Notice: Undefined index: formPmall in /Applications/MAMP/htdocs/tngcse/template4/testperson.php on line 27
[29-Oct-2013 13:30:01 UTC] PHP Notice: Undefined index: formPCSEsiteHeading in /Applications/MAMP/htdocs/tngcse/template4/testperson.php on line 29
[29-Oct-2013 13:30:01 UTC] PHP Notice: Undefined index: formPCSEsiteHeadingText in /Applications/MAMP/htdocs/tngcse/template4/testperson.php on line 30
[29-Oct-2013 13:30:01 UTC] PHP Notice: Undefined index: formPCSEsiteHeadingShadow in /Applications/MAMP/htdocs/tngcse/template4/testperson.php on line 31
For each and every single posted value! Over 60 each time! And the page is opened repeatedly.
More facts: * The HTML form and JS function are two includes. * The PHP variable inits and the form reading are two includes (that I edited into the page for this test)
- I have four pages where these includes works WITHOUT getting any PHP Notice at all!
- And three where all 60+ form inputs are "Undefined"...
I have four more pages to make and don't want to go on before I solve this. I haven't a clue what is wrong here and need any idea you can come up with. EXCEPT suppressing the PHP Notices... (There is an error here that needs to be dealt with the proper way)
Thank You In Advance, Ava T.
Added for clarity: The values coming through to the PHP page AND are displayed on the final page are:
formPmall: 4 (PHP init = 0)
formPCSEsiteHeading: #FF0000 (PHP init = #FF00FF)
formPCSEsiteHeadingText: "My Family" (PHP init = "")
formPCSEsiteHeadingShadow: "2px 2px 4px #000000" (PHP init = "")
Everything is initialized and everything get new values. But it fills the error log for some reason. WHY?
I am not allowed to answer my own question (8 hrs limit) so I edit here:
THE PROBLEM IS SOLVED!
And the solution is even more strange (to me, that is) than the notices. This is what I did:
I took away ALL code and added the PHP script piece by piece and ran it once for every piece. Everything was good: The PHP code by itself didn't generate any notices. So I added the HTML head with two css includes: One general and one modifying some of those general.
No notices: Everything was fine, so I added the HTML piece by piece and found that one class was the "culprit" when referenced to IN THE HTML!
The class was declared like this (modifying a general one: Different colour and no background image)
.line {
color: #FF0000;
background-image: url('');
}
The solution was to declare it like this (totally correct - not sloppy cut-n-paste):
.line {
color: #FF0000;
background-image: none;
}
Every single notice (one for each value POSTed to this page - 60+) was gone!
NOTE that it was not until it was referenced to in the HTML, the PHP notices appeared!
<td class="line">This is my line</td>
I hope this can help others as I have found sooo many posts regarding PHP notice, where the only solution was to turn notices off. And none with a real solution.
Thanks to everyone who took their time to read and reply!
Ava