28, May 2012

combining error and processing output into the same form file? - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: combining error and processing output into the same form file?
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: combining error and processing output into the same form file?  (Read 906 times)
My Name is Enigo Montoya
*
Posts: 33
188 credits
Members referred : 0


« on: Apr 28, 2007, 04:38:21 am »

I found the following script below that works well, but I would like to condense it down into one file.
http://www.plus2net.com/php_tutorial/tell_friend.php

It is a pretty simple script which consists of Tell.php and tellchk.php (Tell.php contains the form and tellchk.php processes data and sends the referral).  The issue I have is that I am using an include statement to include Tell.php into a site and tellchk.php doesn't fit the look of the site. 

I have used 2 files such as this in many other things, but for this it should work better combining everything together.  I have seen <?php echo $_SERVER['PHP_SELF']; ?> used when doing this, but I am not sure about the syntax to be able to include the validation and mail processing into just Tell.php  If someone could take a look at it I would appreciate it.  BTW I am using this in a shopping cart to send the referral link of that particular item. 

Thank you
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1807
9006 credits
Members referred : 6



« Reply #1 on: Apr 28, 2007, 09:28:34 am »

Form and processing in one script can be done like this:
Code:
<?php
if($_POST['name']){
//error checking

//processing

}
else  {
//show form
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
</form>
<?php ?>



Last blog : Are You Stumbling Yet?
My Name is Enigo Montoya
*
Posts: 33
188 credits
Members referred : 0


« Reply #2 on: Apr 29, 2007, 06:26:33 am »

Thank you Mind_nl.  Using your example I was able to get this to work.  The person I am helping on this decided to go with the 2 page setup after all, so I had to change the code on the second file to fit the site.  Thank you for your example, now I can use this in the future.
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=6479
Tags : refer a friend send link Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: combining error and processing output into the same form file?
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 08:41:12 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.