Jump to content

Pass Array From On Epage To Another


1885

Recommended Posts

I am having trouble passing an array from one page to another.

I want to do a data submission check and set the intial values to 0.

//**********************************************************************************************************

page 1:

<?php

session_start();

$inputs = array();

$v = array();

for($i=0; $i<13; $i++) {$v[$i] = 0; $inputs[$i] = 0; //set inputs to 0

 

echo "v = $v[$i] "; // debug

 

 

}

$_SESSION['inputs'] = '$inputs';

?>

<html>

</html>

//**********************************************************************************************************

page 2:

<?php

session_start();

$inputs = $_SESSION['inputs'];

 

//for($i = 0; $i < 13; $i++) echo "$v[$i] -";

for($i = 0; $i < 13; $i++) echo "$inputs[$i] -"; //debug

 

?>

<html>

Input 0

 

<FORM method="post" action="check-inputs.php">

. . .

Link to comment
https://forums.phpfreaks.com/topic/271673-pass-array-from-on-epage-to-another/
Share on other sites

Wow. That was simple. It's been a few years since I've done some php.

It's nice to be coding again. Thanks for the help. I'm sure I'll need a lot more!

 

page 1

 

<?php

session_start();

 

 

$inputs = array();

$v = array();

for($i=0; $i<13; $i++) {$v[$i] = 0; $inputs[$i] = 0;

 

echo "v = $v[$i] ";

 

 

}

$_SESSION['inputs'] = $inputs;

$_SESSION['v'] = $v;

?>

<html>

 

 

page 2

 

<?php

session_start();

$inputs = $_SESSION['inputs'];

$v = $_SESSION['v'];

for($i = 0; $i < 13; $i++) echo "$v[$i] -";

for($i = 0; $i < 13; $i++) echo "$inputs[$i] -";

 

?>

<html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.