473,802 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

First PHP script, need your help to debug

Hello,

I tested a PHP script with a FORM of 2 element and it delivered the
mail but then when I added more FORM elements, it failed to deliver.
Following is the content of the PHP script that I'm talking about, it
is my first PHP script. Please advise what's wrong. The mail server,
kind of unlikely, the first try it sent the mail (beginner's luck?),
all of sudden, it went down? it's not on my box.

Thanks.
<?php

$to_addr = 'd****@yahoo.co m';

if (isset($_REQUES T['submit'])) {
$mail_body .= "WHYSELLING : ".$_REQUEST['WHYSELLING'];
$mail_body .= "\nHOUSEADDRESS : ".$_REQUEST['HOUSEADDRESS'];
$mail_body .= "\nLOANOUTSTAND ING: ".$_REQUEST['LOANOUTSTANDIN G'];
mail($to_addr,' Form One');
print "Thank you for your submission.";
} else {
print<<<_HTML_
<form method="POST" action="$_SERVE R[PHP_SELF]">
<table width="65%" border="4" cellpadding="2" cellspacing="0"
bgcolor="" align="center">
<tr><td>
<table border="0" cellspacing="0" cellpadding="0" bgcolor="">
<tr>
<td>Address of house you are selling:</td>
<td><font size="2" face="Arial">
<input name="HouseAddr ess" type="text" id="HouseAddres s"
size="35">
</font></td>
</tr>
<tr>
<td>Why are you selling?</td>
<td><textarea name="WhySellin g" cols="26" rows="3"
id="WhySelling" ></textarea></td>
</tr>
<tr>
<td>Are there outstanding loans?</td>
<td><font size="2" face="Arial">
<input type="radio" value="Yes" name="LoanOutst anding">
Yes
<input type="radio" name="LoanOutst anding" value="No">
No</font></td>
</tr>

<p align="center">
<input TYPE="submit" NAME="submit" VALUE="Send Form">
</td>
</tr>
</table>

</td></tr>
</table>

</form>
_HTML_;
}

?>
Jul 17 '05 #1
2 2022
In article <9a************ **************@ posting.google. com>,
do***@yahoo.com (DonLi) wrote:
Hello,

I tested a PHP script with a FORM of 2 element and it delivered the
mail but then when I added more FORM elements, it failed to deliver.
Following is the content of the PHP script that I'm talking about, it
is my first PHP script. Please advise what's wrong. The mail server,
kind of unlikely, the first try it sent the mail (beginner's luck?),
all of sudden, it went down? it's not on my box.

Thanks.
<?php

$to_addr = 'do***@yahoo.co m';

if (isset($_REQUES T['submit'])) {
$mail_body .= "WHYSELLING : ".$_REQUEST['WHYSELLING'];
$mail_body .= "\nHOUSEADDRESS : ".$_REQUEST['HOUSEADDRESS'];
$mail_body .= "\nLOANOUTSTAND ING: ".$_REQUEST['LOANOUTSTANDIN G'];
Variable names are case sensitive. $_REQUEST['WHYSELLING']*and
$_REQUEST['whyselling'] isn't the same variable.
mail($to_addr,' Form One');
You didn't include the third required argument to mail() - the actual message
to send. Presumably, you want something like:

$msg = "
Why he is selling: $_REQUEST[whyselling]
The address: $_REQUEST[houseaddress]
Loans outstanding: $_REQUEST[loadoutstanding]
";
mail($to_addr, "A subject line", $msg);

print "Thank you for your submission.";
} else {
print<<<_HTML_
<form method="POST" action="$_SERVE R[PHP_SELF]">
<table width="65%" border="4" cellpadding="2" cellspacing="0"
bgcolor="" align="center">
<tr><td>
<table border="0" cellspacing="0" cellpadding="0" bgcolor="">
<tr>
<td>Address of house you are selling:</td>
<td><font size="2" face="Arial">
<input name="HouseAddr ess" type="text" id="HouseAddres s"
size="35">
</font></td>
</tr>
<tr>
<td>Why are you selling?</td>
<td><textarea name="WhySellin g" cols="26" rows="3"
id="WhySelling" ></textarea></td>
</tr>
<tr>
<td>Are there outstanding loans?</td>
<td><font size="2" face="Arial">
<input type="radio" value="Yes" name="LoanOutst anding">
Yes
<input type="radio" name="LoanOutst anding" value="No">
No</font></td>
</tr>

<p align="center">
<input TYPE="submit" NAME="submit" VALUE="Send Form">
</td>
</tr>
</table>

</td></tr>
</table>

</form>
_HTML_;
}

?>


--
Sandman[.net]
Jul 17 '05 #2
DonLi wrote:
<?php

$to_addr = 'd****@yahoo.co m';

if (isset($_REQUES T['submit'])) {
$mail_body .= "WHYSELLING : ".$_REQUEST['WHYSELLING'];
$mail_body .= "\nHOUSEADDRESS : ".$_REQUEST['HOUSEADDRESS'];
$mail_body .= "\nLOANOUTSTAND ING: ".$_REQUEST['LOANOUTSTANDIN G'];
mail($to_addr,' Form One');
You need to put $mail_body in the mail() call
mail($to_addr, 'Form one', $mail_body);
print "Thank you for your submission.";
} else { (snip) }

?>


But PHP should have complained about that.
Have you changed the error_reporting level?
Put

error_reporting (E_ALL);

at the top of every script you make to see all errors, warnings and
notices in the browser.
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
2903
by: John | last post by:
Hello. If I want to set up my first database and start using it in Dreamweaver what do I need to do? The book I'm working on has a CD with the database on. It is telling me to put it in the MySql folder on drive C. However, when I'm in Dreamweaver I click on Applications at the side, and the plus button to add a MySql database. It tells me to enter the
5
9206
by: deko | last post by:
In regard to running php scripts with cron - Here is a sample script: <?php //debug.php echo "<br> This is a test"; ?> I can call debug.php from a web page on my site like this:
7
1891
by: Chris | last post by:
Hello, I posted a while back about a newbie database question and got a lot of great help here. My script that I am creating has come a long way (For me!) and almost does what I need it too. I am basicly using a dictionary to update a access database using an odbc connector. I am able to connect and it seems that I am able to loop through the code to update all the rows I need to. The one weird bug I seem to get is what ever is the...
36
2121
by: Cap'n Ahab | last post by:
I have used VB3 - VB6, so learning all this OO stuff is reasonably new to me (although I looked at Java a few years ago). Anyway, I thought I would write a small class to begin with, with a property and 2 methods, along with a constructor (where you use New(), I think, yes?). So, I decided to create a class that represents a die, which can be rolled - using a Roll() method - and which has a property to find out the value on the face of...
0
4115
by: hagar | last post by:
Hi all, I have a problem which I can not understand why this is happening! Debugging this I actually see that it grabs first record then when stepping through code to the line rsImportTo.AddNew it drops first record and grabs second record and continues on no problems (but no 1st record in data set) I am reading a text file record 1 is a top of text file. see code below Private Sub CmdFetchNewData_Click() on Error Goto CmdfetchErr Dim...
0
4439
by: Bev | last post by:
Hello :-), I am not sure if I am in the right forum so please forgive me if I err. My Ops is XPPro, SP2 installed, IE6 and Outlook Express6, Office 2002. I am using ready made scripts in htm format and I am getting script errors. I cannot view the script in IE6, Front Page or Outlook. It keeps asking me if I want to debug. I have no idea on how to debug! When I post the work I have done to a group, (I fly blind), my fellow members...
3
4327
by: nuchphasu | last post by:
Hi I have a problem on Dropdownlist that connect database and retrieve data by Ajax.I write javascript like this ------------------------------------------------------------------------- function ManageYear_onchange(machinetype) { var iManageYear=document.forms.ddlManageYear.selectedIndex; var vManageYear=document.forms.ddlManageYear.value;
4
2095
by: dbee | last post by:
Right. I've got a really, really annoying/difficult/time consuming problem with my development environment. I'm using django to build a web app with paypal integration. My server is hosted remotely, and it is receiving IPN (payment notifications) POST requests from Paypal. I've checked on google and irc and this is my last shot at solving this before I go mad ... :-( The problem is that I can't debug those POST requests. Browser...
4
2839
by: Chris8Boyd | last post by:
I am embedding Python in a MSVC++ (2005) application. The application creates some environment and then launches a Python script that will call some functions exported from the MSVC++ application. I want to be able to debug the Python script by using a debug server, like Winpdb (winpdb.org). I use ActivePython 2.5.2.2, Microsoft Visual Studio 2005, and Winpdb 1.3.8.
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10542
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10309
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7600
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6840
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4274
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3795
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.