Out of my head. How to fix this one. My session not working on hostgator server. But on other server it working fine.
Here an example the code.
<form action="/payment-select/" method="post">
<select name="payment" onchange="this.form.submit()">
<option value=""<?php if(empty($_SESSION['payment'])) { echo ' selected="selected"'; } ?>><?php echo $lang_please_select; ?></option>
<?php
$sp = 'SELECT * FROM payment';
$qp = $db->rq($sp);
while($payment = $db->fetch($qp)) {
?>
<option value="<?php echo $payment['bank']; ?>"<?php if($_SESSION['payment'] == $payment['bank']) { echo ' selected="selected"'; } ?>><?php echo $payment['bank']; ?></option>
<?php } ?>
</select>
</form>
The /payment-select/
include_once('includes/connection.php'); // session_start() here
include_once('includes/formatting.php');
$_SESSION['payment'] = strip_html_tags($_POST['payment']);
header("location:/payment/");
exit();
Update
- All required pages have
session_start()
on the top. - I install the script to
server A
working fine. Thenserver B
fine.. But onhostgator
with same phpinfo the$_SESSION['payment']
won't save after header redirect to/payment/
page.
I'm not share the session between server. It's something like I install wordpress on server A ok, Server B ok and Server C problem. ( the situation by example )