Issue
How do I split the URL and then get its value and store the value on each text input?
URL:
other.php?add_client_verify&f_name=test&l_name=testing&dob_day=03&dob_month=01&dob_year=2009&gender=0&house_no=&street_address=&city=&county=&postcode=&email=&telp=234&mobile=2342&newsletter=1&deposit=1
PHP:
$url = $_SERVER['QUERY_STRING'];
$para = explode("&", $url);
foreach($para as $key => $value){
echo '<input type="text" value="" name="">';
}
above code will return:
l_name=testing
dob_day=3
doby_month=01
....
and i tried another method:
$url = $_SERVER['QUERY_STRING'];
$para = explode("&", $url);
foreach($para as $key => $value){
$p = explode("&", $value);
foreach($p as $key => $val) {
echo '<input type="text" value="" name="">';
}
}
Solution
Why not using $_GET global variable?
foreach($_GET as $key => $value)
{
// do your thing.
}
Answered By – Lubor Bílek
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0