I have created a function to validate input.
function validate_dimension($value,$name) {
global $errors;
$errors = array();
......validation actions here - this all works fine - if I get an error it is captured like this . . .
$errors[] = "Dimension value missing";
This is all fine and the $error is returned correctly.
So that I can keep the error, I save it as a Session variable
$_SESSION['errors'] = $errors;
HOWEVER the next time I run the function (with the next dimension to be checked) , $_SESSION['errors'] is overwritten and the first error is lost.
I have solved the problem by creating a new array - $all_errors - and adding $errors to $all_errors each time the function is run - but this seems clumsy - I do not need the function as I could just as easily wite a separate line of code for each dimension to be checked.
Can anyone suggest a better way of doing this?
Please?
PDO returns erroneous columns from within pdt
Hi All,This is a truly weird behavior:When using a simple pdo fetch, erroneous columns are returned!Steps to reproduce:------------------------------------------------------------ -----------1.create
Post PHP form to non-existing page
The company that I work for host their PHP code on IIS on a Windows server, no Apache, so no mod_rewrite. I recently wrote a custom framewok that is loosely based on Codeigniter. To get SEF URL's 'n
php title problem
Hi,I am having a problem managing my page title with PHP.Currently I have my <title> tags in each PHP document, followed by my header.php which has my functions.php file contained in it.
reading xml faster than DB call?
I am trying to optimize a high traffic website, and I enabled a feature where there are three photos selected from the most recently submitted ones, and displayed at the top of the page. I figured
Mail functionality from localhost to server
Hi I am facing problem of mail functionality.When i tested mail functionality in my localhost it works fine but when i tried it on server it didn't work and also no error it displays.So please give me
What do you call the "token" thing?
You know how some sites have links that run on tokens? Tokens are links that only stay alive for a certain amount of time (1 use, 1 day, 1 week, etc).Can someone explain to me what exactly it's
first id from db not showing
I have a php script which displays the content of a mysql table as a html table with sorting, delete/update button, etc. the problem is I can't make it show the first value inserted in the db, it only
help need on ob_start()
HiI am a newbie in php, I have a codeLine number On/Off | Expand/Contract <?phpob_start();for($i=1;$i<=10;$i++){ sleep(1); echo $i; ob_flush();}?> I am trying to
serializing objects - loses methods - the point being?
HiI know that serializing an object will lose the methods. But whats the point in that? What if we need the methods . Lets say the serialized string is sent from an external server where the calling
undefined offset help
Hi All,I kept getting undefined offset PHP notice for a simple for loop. For eg$va = array();$i=0;while($row = mysql_fetch_array($result)){ $va[$i] = $row['id']; $i++;}It gives undefined offset at