I am setting up a registration page. How I have it setup is 3 pages.
registration.php
registration_step2.php
registration_step3.php
Objective:
Create a page for a person to register, after confirmed payment from paypal add details to MYSQL data.
registration.php
session_start();
-random number/letters is created and stored as $_SESSION[confirmation] this is saved as a session for their confirmation number which is displayed to them at the final page
-has form with several input fields
fname
lname
company
phone number
email
price
*address
-form action is registration_step2.php
registration_step2.php
session_start();
$_SESSION[fname] = $_POST[fname];
$_SESSION[lname] = $_POST[lname];
$_SESSION[company] = $_POST[company];
$_SESSION[phone] = $_POST[phone];
$_SESSION[email] = $_POST[email];
$_SESSION[address] = $_POST[address];
$_SESSION[dtstamp] = $_POST[dtstamp];
$_SESSION[price] = $_POST[price];
Recaps the information they submitted previously and stores the variables as sessions variables (above).
-PayPal button (for payment) is displayed for the user to make their payment, after payment with paypal they are redirected to registration_step3.php
registration_step3.php
session_start();
-Inserts session variables into MYSQL
-displays confirmation page with a "success you have made your payment through paypal successfully"
-displays confirmation number $_SESSION[confirmation]
Ok, my questions are. I noticed that everytime I refresh the registration_step3.php it will add the data again in the database MYSQL. So how can I prevent duplicate entries (possibly by confirmation #)?
-Is there anyway of simplify my coding to less pages?
Appreciate any help