Re: Array transform date and put in a session

From: Date: Tue, 29 Jul 2003 22:13:24 +0000
Subject: Re: Array transform date and put in a session
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-157456@lists.php.net to get a copy of this message
Frank Keessen wrote:
I've got a form with a field called datebirth[]; After submitting the form; it must put the datebirth field (or fields) into the mysql format yyyy-mm-dd and after that put it in a session: $date_array = split("-", $_POST['datebirth']); $mysqldate = $date_array[2]."-".$date_array[1]."-".$date_array[0]; $_SESSION['datebirth'] = array(); $_SESSION['datebirth'] = $mysqldate; This is my code till now but i'm stuck (when proccesing it i'm only getting Array... as output).. Can someone help me?
Well, is it $_POST['benchmark'] or $_POST['benchmark'][0] for the first date? If your form element is actually named "benchmark[]" then it's the second. That said, you may be able to just pass the original date to strtotime() and format the resulting unix timestamp. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals – www.phparch.com

« previous php.general (#157456) next »