I have this code:
//fetch data
$data = $_POST['list'];
echo($data);
echo('<br>then<br>');
$data = str_replace("\t", " ", $data);
echo($data);
$matches = array();
$user = array();
preg_match( "/(.+?) ((?:[A-Z])(?:[0-9]+:){3}[0-9]+) ([0-9]+) \/([0-9]+) ([0-9]+) \/ ([0-9]+)/", $data, $matches );
list(,$user['base'],$user['location'],$user['econ'],$user['maxecon'],$user['ports'],$user['maxports']) = $matches;
$base = $users['base'];
$_SESSION['base'] = $base;
$location = $users['location'];
$_SESSION['location'] = $location;
//intergers
$econ = intval(($users['econ']), 10);
$_SESSION['econ'] = $econ;
$maxecon = intval(($users['maxecon']), 10);
$_SESSION['maxecon'] = $maxecon;
$ports = intval(($users['ports']), 10);
$_SESSION['ports'] = $ports;
$maxports = intval(($users['maxports']), 10);
$_SESSION['maxports'] = $maxports;
I know the preg_match
pattern is correct as it is used successfully on another page for the same desired intention in a list where action was performed on each line.
In this example $data
contains the data but $base
, $location
and $tecon
remain empty.
What have I missunderstood or done wroung?
Resources:
see it in action here:http://www.teamdelta.byethost12.com/postroute.php
look at entire code here:http://www.teamdelta.byethost12.com/postroute.txt