Unstoppable Domains โ€” Expired Auctions

$5 - Simple PHP support needed

SpaceshipSpaceship
Watch

dkr

Respect My Authority!VIP Member
Impact
43
Hi,

I am trying to make a checkout system for the hosting section of my website, ewebproz.com, but am having problems. At the moment, I have just created 'step one', and have no idea how to take the information taken from the form to step two, being a whole new page.

Please take a look at http://ewebproz.com/hostingfree1.html. That is 'step one'. I want the info entered by the visitor to go to step two. Then, when the user reaches the last step and press 'finish', I want all of the info entered through out all of the steps to be sent by email to my mail box.

So, my only two difficulties are how to take the info entered from one page to another, and how to let the last checkout page send all this info through my formmail script to my email.

If you are interested in helping, please add me on MSN, or simply post here the solution, although I may have further questions. Your reward is $5. All contributors will be given positive rep, along with possible NP$ donations :).

MSN: kinkarso[at]gmail[dot]com

Thank you,
Donny
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
You could use sessions to send it right through the form, try this:
At the beginning use the function session_start();
On the posted pages use this:
$_SESSION['domain'] = $_POST['domain'];
$_SESSION['subdomain'] = $_POST['subdomain'];
etc....

Then when you want the values called use $_SESSION['domain'], etc.

EXAMPLE:
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Teh FoRm</title>
</head>

<body>
<?
session_start();
if ($_GET['step'] == '2') {
$_SESSION['domain'] = $_POST['domain'];
?>
<form action="sessions.php?step=3" method="post">
<input type="submit" value="Continue" />
</form>
<?
}
elseif ($_GET['step'] == '3') {
echo $_SESSION['domain'];
} else {
?>
<form action="sessions.php?step=2" method="post">
<input type="text" name="domain" />
<input type="submit" value="Continue" />
</form>
<? } ?>
</body>
</html>
 
0
•••
:) I was going to use that technique.
 
0
•••
Borghunter said:
You could use sessions to send it right through the form, try this:
At the beginning use the function session_start();
On the posted pages use this:
$_SESSION['domain'] = $_POST['domain'];
$_SESSION['subdomain'] = $_POST['subdomain'];
etc....

Then when you want the values called use $_SESSION['domain'], etc.

EXAMPLE:
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Teh FoRm</title>
</head>

<body>
<?
session_start();
if ($_GET['step'] == '2') {
$_SESSION['domain'] = $_POST['domain'];
?>
<form action="sessions.php?step=3" method="post">
<input type="submit" value="Continue" />
</form>
<?
}
elseif ($_GET['step'] == '3') {
echo $_SESSION['domain'];
} else {
?>
<form action="sessions.php?step=2" method="post">
<input type="text" name="domain" />
<input type="submit" value="Continue" />
</form>
<? } ?>
</body>
</html>
Just a note, but you can't have any output before the session_start() call. It should go before any HTML or any other php that produces output.
 
0
•••
Thanks, I just put it at the first PHP tag, but nice tip.
 
0
•••
Borghunter you must have output buffering turned on at your server then as under normal conditions it would cause a php error.
 
0
•••
I have no idea, I have never enabled it, must be something wrong on yours. This works fine on my localhost.
 
0
•••
Or you can just simply use hidden fields...
 
0
•••
Borghunter said:
I have no idea, I have never enabled it, must be something wrong on yours. This works fine on my localhost.

No it isnt something wrong with mine it is the normal and accepted behaviour of php. If output (even a space) is sent to the browser and sessions (using cookies which is also default behaviour) or cookies (or for that matter headers) are attempted then an error is issued.

The only way for you not to receive an error is for you to either explicitly not using cookies, have error reporting turned completely off (in which case you would not see any error but nor would the script work) or you have output buffering turned on. 1 way to check is make a page ussually called phpinfo.php (doesnt really matter) with the following content:-

PHP:
<?php
phpinfo();
?>

go to this in your browser and look for output_buffering under normal install it is set to "no value" for you it must be set to on (or 1 can't remember the value it sets as).
 
Last edited:
0
•••
What version of PHP are you using? This has never happend to me, ever.
 
0
•••
4.3 the following is quoted from the php manual itself:-

Note: If you are using cookie-based sessions, you must call session_start() before anything is outputted to the browser.
 
0
•••
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
CatchedCatched
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back