jemz — 2013-02-12T11:27:19-05:00 — #1
Hi, can you help me please is this correct to put parameter in window.location ?,because my code did not work.
$id = $_post['idno'];
$age = $_post['age'];
var idno = '<?php echo $id;?>';
var myage = '<?php echo $age;?>';
Thank you in advance.
chris_upjohn — 2013-02-12T17:47:51-05:00 — #2
var idno = <?php echo "'$id'"; ?>,
myage = <?php echo "'$age'"; ?>;
window.location.href = 'myinformation.php?id=' + idno + '&age=' + myage;
Using a JSON array (recommended)
$data = array(
'idno' => (isset($_POST['idno']) && $_POST['idno']) || '',
'age' => (isset($_POST['age']) && $_POST['age']) || ''
var data = <?php json_encode($data); ?>;
window.location.href = 'myinformation.php?id=' + data.idno + '&age=' + data.myage;
jemz — 2013-02-13T06:10:46-05:00 — #3
Hi chris.upjohn, wow thank you for the solution it's working now...and also i learn that it is okay to put isset in array and pass to json.
Thank you so much.