LebGeeks

A community for technology geeks in Lebanon.

You are not logged in.

#1 September 14 2005

Parabola
Member

PHP HELP ****PROBLEM SOLVED

<html>
    <body>
<?php

if (isset($_POST['submit'])) {

$message = NULL;

if(empty($_POST['name'])) {
    $name = FALSE;
    $message .= "Please enter your name <br />";
} else {
    $name = $_POST['name'];
}

if(empty($_POST['email'])) {
    $email = FALSE;
    $message .= "Please enter your email<br />";
} else {
    $email = $_POST['email'];
}

if(empty($_POST['number'])) {
    $number = FALSE;
    $message .= "Please fill out the number field <br />";
} else {
    $number = $_POST['number'];
}

if(empty($_POST['address'])) {
    $address = FALSE;
    $message .= "Please enter your address <br />";
} else {
    $address = $_POST['address'];
}

if(empty($_POST['comments'])) {
    $comments = FALSE;
    $message .= "Please enter your comments <br />";
} else {
    $comments = $_POST['comments'];
}
    
} // close the first IF statement

//if everything was filled out ok
if ($name && $address && $number && $email && $comments) {

    $ToEmail = 'nassib.elkhoury@gmail.com';
    $ToSubject = 'Enter Subject HEre';
    $Message = "Senders Name: $namen Senders Email: $emailn Senders Phone Number: $numbern Senders Address: $addressn Senders Comments: $comments";
   mail("$ToEmail","$ToSubject","$Message");
   echo "Thanks <b> $name </b> for your comments.";
   
} else {
echo $message;
}
  
?>
</body>
</html>

This is the code I am using for the process of the form. Anyway, I was testing it after completing all the fields I get a message saying "Please enter your comments".

Can anyone help me?

Offline

#2 September 14 2005

mahdoum
Member

Re: PHP HELP ****PROBLEM SOLVED

can i see your code for the form?

Offline

#3 September 14 2005

mahdoum
Member

Re: PHP HELP ****PROBLEM SOLVED

ok, check your msg box :) btw I really recommend you indent your work. It makes it easier to read and de-bug.

Offline

#4 September 14 2005

Parabola
Member

Re: PHP HELP ****PROBLEM SOLVED

Thanks man. akh 3ala yaleh katab el html :@

PROBLEM SOLVED :)

Offline

#5 September 24 2005

fnzahar
Member

Re: PHP HELP ****PROBLEM SOLVED

Dear parabola,

i have a comment about your code.
you see, it's better when you check the informations that the user entered to be checked on the client site before it be send to the server side, for fast responces....

what i want to say, the code you wrote, is a php, it will run on the server side, so you will lose time while sending the information to the server, and then to be checked by apache or iis, and then the user will have a reply on what to do....

so this ain't good for the flow of the information on the server....

what i just like to say, the good reason of javascript or vbscript is to programme the check user's input on the client side, wish means that there is no submit to the server untill all the informations are in good place and generated on the client side before it will be send to the server.

get me

Offline

#6 September 24 2005

mahdoum
Member

Re: PHP HELP ****PROBLEM SOLVED

Yeah I get what you mean, but I mean if time isn't much of an issue (which in most sites it really isn't) and with the advance of internet technology (not in lebanon offcourse :?) I see no other use in using it unless I really wanted to have good programming technique

Offline

#7 September 24 2005

fnzahar
Member

Re: PHP HELP ****PROBLEM SOLVED

well, i can't concider my self as a programmer if i don't respect the best code i can get to build a solution.

no one deserve a solution developer name, unless he is a good developer... so people who don't know how to make a good techniques don't deserve to be developers 

Offline

Board footer