Reputation: 449
I am a little confused on the structure that i need to build this php file.
I have a $_SESSION['Listingname'] = $_GET['Listingname'];
at the start of the file, to get a listingname from the last php file. But i also want to have a button that submit some text and refresh the page. Not sure how i should approach it, because if i refresh/reload the page, then it can't perform $_GET['Listingname']
then it gives an error of undefined method.
Some advice would be appreciated. Thanks
Upvotes: 0
Views: 69
Reputation: 4858
Try something like this...
if(!empty($_GET['Listingname'])) {
$_SESSION['Listingname'] = $_GET['Listingname'];
}
Upvotes: 3
Reputation: 13738
try check empty
if(!empty($_GET['Listingname'])) {
$_SESSION['Listingname'] = $_GET['Listingname'];
}
or try to set in hidden field value of $_SESSION['Listingname']
and send it to again with submit if you want reuse it
Upvotes: 1