|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi every one
I'm try to use multi-dimensional arrays and store the data in Sessions and every time I add new data to the same array but I have problem ever time I try to add now data it's renew all array Please me this is my code /////////////////////////////// <?php session_start(); require_once('user_session.php'); $fristName = $_GET["fName"]; $fatherName = $_GET["faName"]; $famliyName = $_GET["fmName"]; $userData = array(); $userData["frName"] = $fristName; $userData["faName"] = $fatherName; $userData["fmName"] = $famliyName; $allData = array(); $allData[]= $userData; session_register('allData'); $dataShow = null; if($fristName != null) { if($fatherName != null) { if($famliyName != null) { $dataShow = <<<HERE <table border='1' cellpadding='1' cellspacing='1'> <tr> <th> NO </th> <th> Frist Name </th> <th> Fahter Name </th> <th> Famliy Name </th> </tr> <tr> HERE; foreach($_SESSION['allData'] as $ad) { $dataShow .="<strong>".$ad['frName']."</strong>"; $dataShow .="<strong>".$ad['faName']."</strong>"; $dataShow .="<strong>".$ad['fmName']."</strong>"; } $dataShow .="<td>"; $dataShow .= " "; $dataShow .="</td>"; $dataShow .="<td>"; $dataShow .=$userData["frName"]; $dataShow .="</td>"; $dataShow .="<td>"; $dataShow .=$userData["faName"]; $dataShow .="</td>"; $dataShow .="<td>"; $dataShow .=$userData["fmName"]; $dataShow .="</td>"; $dataShow .="</tr>"; $dataShow .="</table>"; echo $dataShow; } } } ?> \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ best Salim |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Tue, 12 Feb 2008 15:36:01 +0100, sahm <sahm007@gmail.com> wrote:
> Hi every one > I'm try to use multi-dimensional arrays and store the data in Sessions > and every time I add new data to the same array > but I have problem ever time I try to add now data it's renew all > array > Please me > > this is my code > /////////////////////////////// > <?php > session_start(); > require_once('user_session.php'); > > $fristName = $_GET["fName"]; I suppose you mean $firstName, not $firstName? Allthough, you are consequent in this.. > $fatherName = $_GET["faName"]; > $famliyName = $_GET["fmName"]; > > $userData = array(); > $userData["frName"] = $fristName; > $userData["faName"] = $fatherName; > $userData["fmName"] = $famliyName; Snip this: > $allData = array(); > $allData[]= $userData; > session_register('allData'); Do this: $_SESSION['allData'] = isset($_SESSION['allData']) ? $_SESSION['allData']: array(); $_SESSION['allData'][] = $userdata; (And forget about the session_register() function, it's kind of deprecated as you don't want register globals on, and we have a convenient $_SESSION array). > $dataShow = null; > > if($fristName != null) > { > if($fatherName != null) > { > if($famliyName != null) > { if(!empty($firstname) && !empty($fatherName) && !empty($familyName)){ -- Rik Wasmus |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Feb 12, 6:14 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Tue, 12 Feb 2008 15:36:01 +0100, sahm <sahm...@gmail.com> wrote: > > Hi every one > > I'm try to use multi-dimensional arrays and store the data in Sessions > > and every time I add new data to the same array > > but I have problem ever time I try to add now data it's renew all > > array > > Please me > > > this is my code > > /////////////////////////////// > > <?php > > session_start(); > > require_once('user_session.php'); > > > $fristName = $_GET["fName"]; > > I suppose you mean $firstName, not $firstName? Allthough, you are > consequent in this.. > > > $fatherName = $_GET["faName"]; > > $famliyName = $_GET["fmName"]; > > > $userData = array(); > > $userData["frName"] = $fristName; > > $userData["faName"] = $fatherName; > > $userData["fmName"] = $famliyName; > > Snip this: > > > $allData = array(); > > $allData[]= $userData; > > session_register('allData'); > > Do this: > > $_SESSION['allData'] = isset($_SESSION['allData']) ? $_SESSION['allData']: > array(); > $_SESSION['allData'][] = $userdata; > > (And forget about the session_register() function, it's kind of deprecated > as you don't want register globals on, and we have a convenient $_SESSION > array). > > > $dataShow = null; > > > if($fristName != null) > > { > > if($fatherName != null) > > { > > if($famliyName != null) > > { > > if(!empty($firstname) && !empty($fatherName) && !empty($familyName)){ > -- > Rik Wasmus Dear Rik Wasmus Thank you vary much for your it's me a lot Best Salim |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Feb 12, 7:36 pm, sahm <sahm...@gmail.com> wrote:
> On Feb 12, 6:14 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote: > > > > > On Tue, 12 Feb 2008 15:36:01 +0100, sahm <sahm...@gmail.com> wrote: > > > Hi every one > > > I'm try to use multi-dimensional arrays and store the data in Sessions > > > and every time I add new data to the same array > > > but I have problem ever time I try to add now data it's renew all > > > array > > > Please me > > > > this is my code > > > /////////////////////////////// > > > <?php > > > session_start(); > > > require_once('user_session.php'); > > > > $fristName = $_GET["fName"]; > > > I suppose you mean $firstName, not $firstName? Allthough, you are > > consequent in this.. > > > > $fatherName = $_GET["faName"]; > > > $famliyName = $_GET["fmName"]; > > > > $userData = array(); > > > $userData["frName"] = $fristName; > > > $userData["faName"] = $fatherName; > > > $userData["fmName"] = $famliyName; > > > Snip this: > > > > $allData = array(); > > > $allData[]= $userData; > > > session_register('allData'); > > > Do this: > > > $_SESSION['allData'] = isset($_SESSION['allData']) ? $_SESSION['allData']: > > array(); > > $_SESSION['allData'][] = $userdata; > > > (And forget about the session_register() function, it's kind of deprecated > > as you don't want register globals on, and we have a convenient $_SESSION > > array). > > > > $dataShow = null; > > > > if($fristName != null) > > > { > > > if($fatherName != null) > > > { > > > if($famliyName != null) > > > { > > > if(!empty($firstname) && !empty($fatherName) && !empty($familyName)){ > > -- > > Rik Wasmus > > Dear Rik Wasmus > Thank you vary much for your > it's me a lot > Best > Salim Dear Mr. Rik Wasmus Thank for your I have one more problem How can I make ($_SESSION['allData']) available for all my php file or function in another file and I will be Thank full for your Best Salim |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Sat, 16 Feb 2008 16:17:09 +0100, sahm <sahm007@gmail.com> wrote:
> On Feb 12, 7:36 pm, sahm <sahm...@gmail.com> wrote: >> On Feb 12, 6:14 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote: >> >> >> >> > On Tue, 12 Feb 2008 15:36:01 +0100, sahm <sahm...@gmail.com> wrote: >> > > Hi every one >> > > I'm try to use multi-dimensional arrays and store the data in >> Sessions >> > > and every time I add new data to the same array >> > > but I have problem ever time I try to add now data it's renew all >> > > array >> > > Please me >> >> > > this is my code >> > > /////////////////////////////// >> > > <?php >> > > session_start(); >> > > require_once('user_session.php'); >> >> > > $fristName = $_GET["fName"]; >> >> > I suppose you mean $firstName, not $firstName? Allthough, you are >> > consequent in this.. >> >> > > $fatherName = $_GET["faName"]; >> > > $famliyName = $_GET["fmName"]; >> >> > > $userData = array(); >> > > $userData["frName"] = $fristName; >> > > $userData["faName"] = $fatherName; >> > > $userData["fmName"] = $famliyName; >> >> > Snip this: >> >> > > $allData = array(); >> > > $allData[]= $userData; >> > > session_register('allData'); >> >> > Do this: >> >> > $_SESSION['allData'] = isset($_SESSION['allData']) ? >> $_SESSION['allData']: >> > array(); >> > $_SESSION['allData'][] = $userdata; >> >> > (And forget about the session_register() function, it's kind of >> deprecated >> > as you don't want register globals on, and we have a convenient >> $_SESSION >> > array). >> >> > > $dataShow = null; >> >> > > if($fristName != null) >> > > { >> > > if($fatherName != null) >> > > { >> > > if($famliyName != null) >> > > { >> >> > if(!empty($firstname) && !empty($fatherName) && !empty($familyName)){ > How can I make ($_SESSION['allData']) available for all my php file or > function in another file $_SESSION is a superglobal, so it will be available anywhere in the script, provided you have called session_start(). This should be done on every request you want to use the $_SESSION array in. -- Rik Wasmus |
|
![]() |
| Outils de la discussion | |
|
|