Greetings,
I've been thinking this since I start using session, I have here 2 script one is input form and the other is where the variable pass in a session and put it in array.
<form action="sessionarray.php" method="post">
name<input type="text" name="name" size="20">
<input type="submit" name="submit" value="submit">
</form>
<?
session_start();
if ($_POST['submit']) {
echo "<b>NAME</b><br/>";
$sname=$_POST['name'];
$_SESSION['name'][]=$sname;
if(isset($_SESSION['name'])) {
foreach($_SESSION['name'] as $n) {
echo $n."<br />";
}
}
}
print "<br /><br />";
print "<a href=multiarray.php>Insert name again</a><br/>";
?>
this is the output if you continues inserting a name,
sample output:
NAME
dianne
dina
leah
QUESTIONS: How do I make a variable for each name, example
$n1=dianne;
$n2=dina;
$n3=leah;
How do i do this? please..
thanks,
eli