NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page $5 - Simple PHP support needed

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 06-21-2006, 06:59 PM THREAD STARTER               #1 (permalink)
dkr
Respect My Authority!
Join Date: Jul 2005
Location: Canada
Posts: 2,236
dkr has a brilliant futuredkr has a brilliant futuredkr has a brilliant futuredkr has a brilliant futuredkr has a brilliant futuredkr has a brilliant futuredkr has a brilliant futuredkr has a brilliant futuredkr has a brilliant futuredkr has a brilliant futuredkr has a brilliant future
 



Save The Children Baby Health

$5 - Simple PHP support needed


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 .
????: NamePros.com http://www.namepros.com/programming/209576-5-simple-php-support-needed.html

MSN: kinkarso[at]gmail[dot]com

Thank you,
Donny
__________________
Follow Me (new!): @donnyouyang
Founder @ Rayku | Kinkarso Tech
dkr is offline  
Old 06-21-2006, 07:53 PM   #2 (permalink)
Resistance is Futile
 
Kadenz's Avatar
Join Date: Apr 2006
Location: Montreal, Canada
Posts: 1,094
Kadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to all
 



Wildlife Lou Gehrig's Disease (ALS)
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 Code:
<!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'];
????: NamePros.com http://www.namepros.com/showthread.php?t=209576
?>
<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>
__________________
Freelance Web Developer
PHP, MySQL, XHTML, CSS, Javascript, jQuery, Wordpress
Portfolio: www.bundy.ca
Kadenz is offline  
Old 06-21-2006, 07:54 PM   #3 (permalink)
Senior Member
 
lpxxfaintxx's Avatar
Join Date: May 2006
Location: Irvine, CA
Posts: 1,082
lpxxfaintxx is just really nicelpxxfaintxx is just really nicelpxxfaintxx is just really nicelpxxfaintxx is just really nice
 



I was going to use that technique.
lpxxfaintxx is offline  
Old 06-21-2006, 08:59 PM   #4 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Originally Posted by Borghunter
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 Code:
<!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') {
????: NamePros.com http://www.namepros.com/showthread.php?t=209576
$_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.
Eric is offline  
Old 06-21-2006, 09:58 PM   #5 (permalink)
Resistance is Futile
 
Kadenz's Avatar
Join Date: Apr 2006
Location: Montreal, Canada
Posts: 1,094
Kadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to all
 



Wildlife Lou Gehrig's Disease (ALS)
Thanks, I just put it at the first PHP tag, but nice tip.
__________________
Freelance Web Developer
PHP, MySQL, XHTML, CSS, Javascript, jQuery, Wordpress
Portfolio: www.bundy.ca
Kadenz is offline  
Old 06-22-2006, 12:41 AM   #6 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
Borghunter you must have output buffering turned on at your server then as under normal conditions it would cause a php error.
Peter is offline  
Old 06-22-2006, 12:57 PM   #7 (permalink)
Resistance is Futile
 
Kadenz's Avatar
Join Date: Apr 2006
Location: Montreal, Canada
Posts: 1,094
Kadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to all
 



Wildlife Lou Gehrig's Disease (ALS)
I have no idea, I have never enabled it, must be something wrong on yours. This works fine on my localhost.
__________________
Freelance Web Developer
PHP, MySQL, XHTML, CSS, Javascript, jQuery, Wordpress
Portfolio: www.bundy.ca
Kadenz is offline  
Old 06-22-2006, 01:07 PM   #8 (permalink)
Senior Member
 
lpxxfaintxx's Avatar
Join Date: May 2006
Location: Irvine, CA
Posts: 1,082
lpxxfaintxx is just really nicelpxxfaintxx is just really nicelpxxfaintxx is just really nicelpxxfaintxx is just really nice
 



Or you can just simply use hidden fields...
lpxxfaintxx is offline  
Old 06-22-2006, 01:20 PM   #9 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
Originally Posted by Borghunter
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.
????: NamePros.com http://www.namepros.com/showthread.php?t=209576

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 Code:
<?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 by filth@flexiwebhost; 06-22-2006 at 01:26 PM.
Peter is offline  
Old 06-22-2006, 02:00 PM   #10 (permalink)
Resistance is Futile
 
Kadenz's Avatar
Join Date: Apr 2006
Location: Montreal, Canada
Posts: 1,094
Kadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to all
 



Wildlife Lou Gehrig's Disease (ALS)
What version of PHP are you using? This has never happend to me, ever.
__________________
Freelance Web Developer
PHP, MySQL, XHTML, CSS, Javascript, jQuery, Wordpress
Portfolio: www.bundy.ca
Kadenz is offline  
Old 06-23-2006, 12:37 AM   #11 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
4.3 the following is quoted from the php manual itself:-

Quote:
Note: If you are using cookie-based sessions, you must call session_start() before anything is outputted to the browser.
Peter is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 09:31 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger