Click here to Skip to main content
15,887,596 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
QuestionHow Can I Start? Pin
code_breaker18-Dec-09 5:37
code_breaker18-Dec-09 5:37 
AnswerRe: How Can I Start? Pin
EliottA18-Dec-09 5:44
EliottA18-Dec-09 5:44 
GeneralRe: How Can I Start? Pin
code_breaker18-Dec-09 5:55
code_breaker18-Dec-09 5:55 
QuestionPerl test script to generate a crystal report Pin
Steve Holdorf17-Dec-09 3:12
Steve Holdorf17-Dec-09 3:12 
AnswerRe: Perl test script to generate a crystal report Pin
Sethsdad15-Jan-10 9:45
Sethsdad15-Jan-10 9:45 
QuestionKickStart Pin
plnakumar15-Dec-09 19:39
plnakumar15-Dec-09 19:39 
AnswerRe: KickStart Pin
Richard MacCutchan15-Dec-09 23:29
mveRichard MacCutchan15-Dec-09 23:29 
GeneralRe: KickStart Pin
plnakumar16-Dec-09 17:17
plnakumar16-Dec-09 17:17 
AnswerRe: KickStart Pin
markkuk16-Dec-09 2:15
markkuk16-Dec-09 2:15 
GeneralRe: KickStart Pin
plnakumar16-Dec-09 17:19
plnakumar16-Dec-09 17:19 
QuestionSimple trouble. Pin
Nikz215-Dec-09 11:59
Nikz215-Dec-09 11:59 
AnswerRe: Simple trouble. Pin
cjoki16-Dec-09 9:00
cjoki16-Dec-09 9:00 
GeneralRe: Simple trouble. Pin
Nikz216-Dec-09 9:48
Nikz216-Dec-09 9:48 
QuestionJoomFish problem with my component Pin
sharkbc13-Dec-09 16:48
sharkbc13-Dec-09 16:48 
AnswerRe: JoomFish problem with my component Pin
Marc Firth14-Dec-09 2:24
Marc Firth14-Dec-09 2:24 
GeneralRe: JoomFish problem with my component Pin
sharkbc15-Dec-09 0:04
sharkbc15-Dec-09 0:04 
GeneralRe: JoomFish problem with my component Pin
sharkbc25-Jan-10 15:08
sharkbc25-Jan-10 15:08 
QuestionREMOTE ACCESS OF MYSQL? Pin
hifiger200411-Dec-09 7:31
hifiger200411-Dec-09 7:31 
AnswerRe: REMOTE ACCESS OF MYSQL? Pin
EliottA11-Dec-09 7:41
EliottA11-Dec-09 7:41 
QuestionError while sending e-mail Pin
Gagan.2011-Dec-09 5:46
Gagan.2011-Dec-09 5:46 
Hi all.

I am new to PHP and trying to learn it.I have created a web page and defined items as below :

<form method="POST" action="send.php">
      <font color="green"> Full Name : </font>
      <input type="text" name="name" size="20">

      <font color="green"> Gotra(Clan) : </font>
      <input type="text" name="gotra" size="20">

      <font color="green"> Father's Name : </font>
      <input type="text" name="fname" size="20">

      <font color="green">Details of Prasad to be Offered : </font>
(eg.: name of temple, quantity of prasad, specific date & any other requirements)
      <textarea rows="5" name="prasad" cols="40" ></textarea>

      <font color="green"> Any Wish to God  : </font>
      <textarea rows="5" name="wish" cols="40" ></textarea>

      <font color="green"> Postal Address : </font>
      <textarea rows="5" name="address" cols="40" ></textarea>

      <font color="green"> Phone no.  : </font>
      <input type="text" name="phone" size="20">

      <font color="green"> Preferred Time of Contact : </font>
      <input type="text" name="time" size="20">

      <font color="green"> Email address : </font> 
      <input type="text" name="email" size="20">

	<br>      
	 <input name="Submit" type="submit" class="input" value="Send">
         <input name="Submit2" type="reset" class="input" value="Reset">
        </br>         
     </form>


and the send.php has following block of code :

<?php 
if(isset($_POST['submit'])) { 
$to = "gagan.u20@gmail.com"; 
$subject = "E-Prasad Details"; 
$name_field = $_POST['name']; 
$gotra_field=$_POST['gotra'];
$fname_field = $_POST['fname']; 
$prasad=$_POST['prasad'];
$wish=$_POST['wish'];
$address=$_POST['address'];
$phone_field=$_POST['phone'];
$time_field=$_POST['time'];
$email_field=$_POST['email'];
  
$body = "From: $name_field\n Gotra: $gotra_field\n Father's name: $fname_field\n Details of prasad to be offered : $prasad\n Any wish to God: $wish\n Postal address : $address\n Phone no. : $phone_field\n Preferred time of contact : $time_field\n E-mail address : $email_field"; 
  
echo "Data has been submitted!"; 
mail($to, $subject, $body); 
} else { 
echo "An error occurred! Please try again."; 
} 
?> 


Now the problem is, when I fill the form and click og sublit button, it gives an error that "An error occurred! Please try again."

Tell me where am I wrong in writing the code. Tell me the correct code.

Thanks.

Gagan
AnswerRe: Error while sending e-mail Pin
Dr.Walt Fair, PE11-Dec-09 6:55
professionalDr.Walt Fair, PE11-Dec-09 6:55 
GeneralRe: Error while sending e-mail Pin
Gagan.2011-Dec-09 16:21
Gagan.2011-Dec-09 16:21 
GeneralRe: Error while sending e-mail Pin
Dr.Walt Fair, PE11-Dec-09 16:52
professionalDr.Walt Fair, PE11-Dec-09 16:52 
GeneralRe: Error while sending e-mail Pin
Gagan.2011-Dec-09 21:47
Gagan.2011-Dec-09 21:47 
GeneralRe: Error while sending e-mail Pin
Dr.Walt Fair, PE12-Dec-09 5:23
professionalDr.Walt Fair, PE12-Dec-09 5:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.