|
Posted by "Sjef Janssen" on 09/25/13 11:36
Hallo there,
I try to put a number of variables in an array as follows:
input boxes gather info. This info is language dependent, so the info is put
into an array vke with indexes NL and EN. The POST variable gives this array
back. Then I want to add a variable to this array, 'gebruikt' (=used) with
possible values J or N.
The script looks something like so:
<?php
session_start();
if ($_POST['vkePlus'])
{
$waarden[] = array('gebruikt'=>'J',$_POST['vke']);
foreach ($waarden as $i=>$w)
{
if (is_array($w))
{
foreach($w as $iw=>$ww)
{
if (is_array($iw))
{
//What happening here???
}
else
{
echo stripslashes($iw) . ": " . stripslashes($ww) . "<br/>";
}
}
}
else
{
echo stripslashes($i) . ": " . stripslashes($w) . "<br/>";
}
}
}
print ("<h1>Test</h1>\n");
print ("<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n");
print ("<input type=\"text\" size=\"10\" name=\"vke[NL]\" value=\"" .
$vke[NL] . "\">\n");
print ("<input type=\"text\" size=\"10\" name=\"vke[EN]\" value=\"" .
$vke[EN] . "\">\n");
print ("<input type=\"submit\" name=\"vkePlus\" value=\"GoGo\">\n");
print ("</form>\n");
?>
I have problems reading the contents of the arrays. Especially reading the
second array seems impossible.
After all this I want to add the contents of the array to a Session variable
to keep it in furthwer steps (of a wizard).
I hope any of you can 'make chocolat' of this.... ;-))
Thanks!!
Sjef
p.s. I use php 4.
Navigation:
[Reply to this message]
|