Re: Array transform date and put in a session
| From: | Frank Keessen | Date: | Tue, 29 Jul 2003 21:15:04 +0000 |
| Subject: | Re: Array transform date and put in a session | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157437@lists.php.net to get a copy of this message | ||
Hi David,
Thanks for your reply... This makes no sense;
According to the rest of your code, it should be called datebirth,
not datebirth[].
Let me put in the whole code
<?
session_start();
$aantalpers=$_SESSION["aantalpers"];
$_POST["submit"]=isset($_POST["submit"])?$_POST["submit"]:"";
if($_POST['submit']!="")
{
$date_array = split("-", $_POST['datebirth']);
$mysqldate = $date_array[2]."-".$date_array[1]."-".$date_array[0];
session_start();
$_SESSION['datebirth'] = array();
$_SESSION['datebirth'] = $mysqldate;
session_write_close();
header("Location: step3.php");
exit;
}
?>
<html>
<head>
<link rel="stylesheet" href="../css/main.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#F2D071">
<form name="form1" method=post id=form1 enctype=multipart/form-data
action=<?=$_SERVER['PHP_SELF']?>>
<table width="75%" border="0">
<tr>
</select>
</tr>
</td>
<tr>
<tr>
<?
for ($i=1; $i<=$aantalpers; $i++)
{
?>
<td><font class="bold">People number <? echo $i;
?></font></td></tr>
<td width="46%">Date of birth</td>
<td width="54%"><? echo "<input type=\"text\"
name=\"datebirth[$i]\"
size=\"10\"><br>"; ?></td>
</tr>
<?
}
?>
</table>
<input type=submit name=submit value=send!>
</form>
</body>
</html>
Regards,
Frank
From: "David Nicholson" <me@djnicholson.com>
To: "Frank Keessen" <fkeessen@planet.nl>
Cc: <php-general@lists.php.net>
Sent: Tuesday, July 29, 2003 11:02 PM
Subject: Re: [PHP] Array transform date and put in a session
Hello,
This is a reply to an e-mail that you wrote on Tue, 29 Jul 2003 at
21:42, lines prefixed by '>' were originally written by you.
> Hi All,
> Can you please help me with the following:
> I've got a form with a field called datebirth[];
According to the rest of your code, it should be called datebirth,
not 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?
--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/
Professional Web Development by David Nicholson
http://www.djnicholson.com/
QuizSender.com - How well do your friends actually know you?
http://www.quizsender.com/
(developed entirely in PHP)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php