Yes, and it works in pageFileGet() but not in pageSortData(). Could it possibly have anyhing to do with using enctype="multipart/form-data" in pageFileGet()?
Class variable not showing up
Anything is possible. I'm out of ideas at the point, haha. Sorry.
I thank you for all of your help in this problem!! (Even if it is never resolved)
I tried using this to verify that the variable was set:
if(isset($this->fieldCount)){
echo "SET";
}else{
echo "NOT SET";
}
it echoed back "NOT SET"
This is bananas
You are very welcome for the help! That's why I signed up here.
Try making a new function altogether like this:
function ImNew () {
echo $this->fieldCount;
}
and call that function instead of pageSortData. Near as I can tell, that variable never has a value set to it, and that is why it is "not set."
Nothing with that either
When the page loads, there first call is to that function, is it not? If it is, then setting the value in the previous function does nothing...
i thought that if i set a variable in the class, then that variable would retain that value until destoryed. Is this not the case?
Not if you reload the page. :xbones:
so what would you suggest?
I would suggest passing that value in your form in a "hidden" field via
<input type="hidden" name="numitems" value="' . $this->fieldCount . '" />
and then calling the function with
pageSortData ($_POST['numitems']);
and making this your new function:
function pageSortData ($num) {
$this->fieldCount = $num;
// etc...
}
See if that works!
Thank you VERY much for all the help!!! I have to head out to work for now (night shift). I will try your example tomorrow and post the results. Once again, thanks you very much!!
I don't really like that idea: it assumes that no-one will attempt to mess with the value before it gets sent back.
What is the precise flow of logic in this? The only place $fieldCount gets set is in pageFileGet(), so that has to be called before pageSortData(); the only way this can happen is if
$POST['batch_submit'] is set,
$_POST['input_type']=='file', and
$_POST['upload_submit'] is set.
Have I got that right?
On an off-side note: is there any particular reason you're using <?include('style.css')?> instead of using a stylesheet <link> tag in the HTML? It seems the latter would be simpler and quicker for all concerned.
Oh, and EEWWW!!! <font> tags!!!!!
batch_submit and input_type=="file" is what ends up setting $this->fieldCount. once upload_submit is set, then pageSortData attempts to call $this->fieldCount. Only problem is, it never finds the variable.
I didn't think about the <link> tag, and it was easier to me to do it with and include.
How else would you accomplish the font deal? (<body> tag? css?)
That is indeed where CSS comes in! If you want the whole body to be that font, try something like <body style="font-family: 'Lucida Console';">.
Weedpacket is definitely right when he mentions that the user might try to tamper with the info in the hidden field, so instead perhaps a cookie or a session? Because I really don't see any other way...
I have decided to use $_SESSION to store all my variables. Thanks for all the help guys!!