I am having some strange problem.
- I have a form:
<form action="goToStripe.php" method="POST">
<div style="padding-bottom: 30px;">
<input type="radio" name="level" value="1" checked>Beginner</input>
<input type="radio" name="level" value="2">Intermediate</input>
<input type="radio" name="level" value="3">Expert</input>
</div>
<label>E-mail:</label>
<input type="email" name="email" /> <br>
<input type="submit" name="submit" value="submit" />
</form>
- I have a php file ‘goToStripe.php’:
session_start();
$eepasts = (isset($_POST['email']) ? $_POST['email'] : null);
$_SESSION['eepasts'] = $eepasts;
header("refresh:5;url=https://buy.stripe.com/stripepaymentlinkishere");
- Then, after the payment link is completed, there is a redirect to a different file, where i try to get the $_SESSION data again (emailConfirmation.php):
session_start();
echo $_SESSION['eepasts'];
So, after the stripe payment i go to this emailConfirmation.php file and i see that this $_SESSION[‘eepasts’] is empty, so I have lost the data. But the strange thing is – I lose the data only on the first try – when i reload the page and go through all this again, everything works. So, when I open an Incognito mode and go to my website, after payment i lose the SESSION data, but after reload (without closing Incognito mode) and go through this process again, everything works.
Any ideas? Thanks!
I saw that there has been some similar errors. Also I’ve heard about webhooks, but don’t really understand how they work (sorry, I’m just a programmer-enthusiast). Mainly I want to store only the email address in the $_SESSION, so, I hope I can get through with only this logic:
- Form in html
- Action file goToStripe.php where i save the email into SESSION and redirect to stripe payment link
- Redirect from stripe to emailConfirmation.php file which will then send an email to this email ($_SESSION[’email’]) that i stored previously in the goToStripe.php file.
Thanks!
1