Lost Password?

Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-12-2007, 04:35 PM
tfusion's Avatar   
tfusion tfusion is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 50
Rep Power: 7
tfusion is on a distinguished road
Default Need Help With a Script

Hello, Im working on a site(GoldWriters Home) I need a mailing form for the ordering page(www.goldwriters.info/order.php).
The problem is that my mail form file isnt working. I have it included in order.php but doesnt work, i need someone to help me fix the code or find the error.

HTML SCRIPT:
HTML 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">
<body>

PHP SCRIPT:

PHP Code:
<?php
#########################
##Goldwriters Mail Form##
####By Tfusion(Admin)####
#########################

//Vars Declaration
$adminemail "orders@goldwriters.info";
$name $_POST["name"];
$email $_POST["email"];
$plan $_POST["plan"];
$message $_POST["message"];

//Error Checking
if ($name == "") {
include 
"mailform.php";
echo 
"Please write your contact name\n";
}

if (
$email == "") {
include 
"mailform.php";
echo 
"Please write your contact email\n";
}

if (
$plan == "") {
include 
"mailform.php";
echo 
"Please specify the plan you want\n";
}

if (
$message == "") {
include 
"mailform.php";
echo 
"Please write what you need, your site link, etc\n";
}

//Mail Content
$mailcontent"New writing order at Gold Writers with the following info:\n
----------------------------------------------\n
Name: $name\n
Email: $email\n
Requested Plan: $plan\n
----------------------------------------------\n
The Message Was:\n
$message\n
----------------------------------------------\n
Generated By GoldWriters Mail Script\n
----------------------------------------------\n"
;

//Email Sending
if ($submit) {
mail ("$adminemail""Writing Order"$mailcontent);
}
?>

HTML SCRIPT:

HTML Code:
<center>
<table border="0" cellpadding="0" cellspacing="0">
<form method="post">
       <tr>
           <td>
               <font size="2" face="Verdana"><b>Name<font color="#FF0000">*</font>:</b></font>
         </td>
           <td width="182">
               <input type="text" name="name" value="" size="30" maxlength="40">
         </td>
       </tr>
       <tr>
           <td>
               <font size="2" face="Verdana"><b>E-Mail Address<font color="#FF0000">*</font>:</b></font>
               </td>
           <td>
               <input type="text" name="email" value="" size="30" maxlength="50">
               </td>
       </tr>
       <tr>
           <td>
               <font size="2" face="Verdana"><b>Plan<font color="#FF0000">*</font>:</b></font>
			   <br /> If you dont know what to put, <a href="plans.php">Check here</a>
               </td>
           <td>
               <input type="text" name="plan" value="" size="30" maxlength="40">
               </td>
       </tr>
       <tr>
           <td colspan="2">
               <font size="2" face="Verdana"><b>Extra Info<font color="#FF0000">*</font>:</b></font>
			   <br />Plase include your site link, instructions, etc.
               </td>
       </tr>
       <tr>
            <td colspan="2">
                <textarea rows="10" cols="50" name="message" maxlength="500"></textarea>
                </td>
       </tr>
       <tr>
           <td colspan="2">
               <input type="reset" value="Reset">
               <input type="submit" name="submit" value="Send Information">
               </td>
       </tr>
       <tr>
           <td colspan="2" align="center">
               <font size="2" face="Verdana"><font color="#FF0000">*</font> Required </font>
               </td>
       </tr>
	   </form>
</table>
</center>
</body>
</html>
Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 04-12-2007, 07:38 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 19
Posts: 2,731
Last Blog:
Passwords
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John
Default

If you could be a little more specific than its "not working" I could help you. In the mean time, you can have a look at this tutorial mail() function
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-12-2007, 10:02 PM
tfusion's Avatar   
tfusion tfusion is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 50
Rep Power: 7
tfusion is on a distinguished road
Default

Thanks for the tut, but i already know how to use the mail function.
The problem is that the mail form isnt showing in the page, its not that is not included well, its that something is wrong with the script because it wont open if i open mailform.php in my browser.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-13-2007, 08:10 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 19
Posts: 2,731
Last Blog:
Passwords
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John
Default

Well you kind of have me confused how you posted your code. Which code is mainform.php and which order.php?

Also, its better to use the isset() function to test if variables are empty/nonempty. So a better way would be to do

PHP Code:
if (!isset($name)) {
include 
"mailform.php";
echo 
"Please write your contact name\n";

And as a side note, I usually like to do form validation in JavaScript, it saves a lot submissions/checks/redirects.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-14-2007, 09:22 AM
tfusion's Avatar   
tfusion tfusion is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 50
Rep Power: 7
tfusion is on a distinguished road
Default

I havent included the order.php file here, what i posted is all the mailform.php script... Thanks for that... i tested out but the form still not showing
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 04-14-2007, 07:35 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 19
Posts: 2,731
Last Blog:
Passwords
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John
Default

Oh well I think the problem is, your including mailform.php infinity times.

Essentially what happens is
1) You load mailform.php
2) It checks and sees that $name == ""
3) Loads mailform.php
4) It checks and sees that $name == ""
5) Loads mailform.php again
6) It checks and sees that $name == ""
7) Loads mailform.php again
and so on

Until the max amount of memory for php is reached and it then fails
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



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

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript:Tutorial, Using an External Script TcM Javascript 7 09-11-2007 07:39 AM
(Script) Copy content to clipboard, how? annannienann Visual Basic Programming 0 06-19-2007 05:20 PM
Need help with proxy script please TcM PHP Forum 4 05-16-2007 09:54 AM
Packet Loss Perl Script Jordan Tutorials 1 04-29-2007 12:29 PM


All times are GMT -5. The time now is 12:23 AM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
LogicKills ........ 20.00000
gaylo565 ........ 18.00000
WingedPanther ........ 15.00000
|pH| ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 67%

Ads