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.
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;
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.
This topic is now closed. New replies are no longer allowed.