0

Hi my friends , I was working on a web page and want to send users comment to the website owner .I use wamp server .... Here is the php code

<?php

$to='compnay@yahoo.com';
$from=$_POST['txtEmail'];
$title=$_POST['txtTitle'];
$body=$_POST['txtMsg'];


if($_POST['form1'].submit)// to check wheter the form has been sent or not
 //echo 'thank you' ;
 {
    if(mail($to,$title,$body,'From:'.' '.$from))
    {
    echo '<h1 class="pageName" >Thank you!
 </h1>
<p>Email sent. We will contact you as soon as possible
 </p><p><br /></p>';
    } 
    else
    {
     echo '<h1 class="pageName">Email not sent!
     </h1>
    <p class="bodyText">Either the email you sent doesnt exist or 
     &nbsp;&nbsp;&nbsp;&nbsp;you didnt fill the fields appropriately<p><br />          </p>';
     }

} 
?>

peoples told me to make a correction to the php_ini() file ... and i did that too ... just changing the smtp to our ISP the port is still 25 ... but I didnt get anything new ... can any body help me please

Edited by Reverend Jim: Fixed formatting

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Will Gresham
0

Instead of this:

if($_POST['form1'].submit)

Try this:

if(isset($_POST['submit_button_id']))

Replace 'submit_button_id' with the ID of the submit button.

0

Instead of this:

if($_POST['form1'].submit)

Try this:

if(isset($_POST['submit_button_id']))

Replace 'submit_button_id' with the ID of the submit button.[/QUOTE]

I used

if($_POST['form1'].submit)

because

  1. the button is not type submit but it is rater normal button
  2. I do this because I want validate the values of the text areas and other using javascript function.But in the javascript function.. if all things go well i called form1.sbumit value.

I think that is not the problem .... but something around the smtp server

can you help me with that

Edited by mike_2000_17: Fixed formatting

0

PHP does not reference objects in that way.
$_POST is an array of the objects in the form (Inputs, Buttons, Selects etc..)
$_POST does not reference the form itself, so unless you have a field with the id form1, it will return a null value.

As above, use the ID of the button that is clicked in this statement:

if(isset($_POST['button_id']))
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.