Hello all,
First time poster!
I've been asked to create a simple HTML form that submits and sends the information to a particular email.
The client is using PHP. Since I have a .NET and C# background, I've never done any PHP code in my life.
Regardless of the technology, this is a trivial task, so I opened Google and search for PHP email forms example which I did find.
The HTML form and the PHP code works great, it does what it needs to do but the problem I have is:
I would like to display a message, once the form is submitted, saying "Thank you for submitting your request...".
In addition, I would also like to display a red message right next to the textbox if the user has not entered an email.
I do not wish to go crazy with all possible validation rules and what not, this is/will be a very simple form.
The PHP code I have so far, is the following:
Code: <?php
$name = $_REQUEST['txtName'];
$address = $_REQUEST['txtAddress'];
$city = $_REQUEST['txtCity'];
$email = $_REQUEST['txtEmail'];
if($email != '')
{
$body = "A user has submitted a form with the following:nn";
$body .= "Name: $namen";
$body .= "Address: $addressn";
$body .= "City: $cityn";
$body .= "Email: $emailn";
mail( "myemail@test.com", "My nice little subject", $body, "From: $email");
print "Thank you for submitting your request..."
}
else
{
print "Email address is mandatory!"
}
?>
The <form> tag submits to itself using the following:
<form method="post" action="<?php echo $PHP_SELF;?>">
The <form> has 4 textboxes and one submit button.
If the user submits the form without entering an email address, at the top of the page the phrase "Email address is mandatory!".
But I do not wish for this message to be displayed at the top of the page, I'd like the message to be disaplyed next to the textbox in question (or underneath).
The same thing for when the form is submitted correctly, I'd like to display a message at the bottom of the <form>.
Looks like the "print" method isn't enough...should I have some kind of place holder <div> (or label) placed next to the textbox and make the "print" method write in that <div>.
As I said, this should be somewhat trivial for any one that has more then 5 min exposure to PHP.
Thanks
Display the user's weight lost in the past week
Hello everyone,I am working on a weight loss app for my site, and I want to display the user's weight lost in the past week, I have the current weight and the total weight lost today working great,
update the selected existing records of database
Hi frndz,I am new to php and get stuck.... Edit.php > Update.php > Updateaction.phpi have 1 edit page displaying results existing in database with chkbox in front of every record and
upgrade from 4.7 to ECC 6.0
Hi all,
a multi dimensional array with for each
hi, I have been asked to write an array, I have Zone 2,3,4,5,6,7,8 each zone has 3 sections of weight, 0 = 70, 71 = 100, 101 = 150, each zone has an average number of say about 0.147 and a Base number
how can i make a .gif images for my site
Dear Friends ,Pls solve my problem , I am starting making new site but i dont know how can i make a .gif images for my site . Is there any editor to make my .gif images comfortably
Session is not saving
I am not trying to do anything too fancy, I am just trying to get some $_SESSION data to save and use it on the next page, but so far no luck. Its saving some data to $_SESSION['name'] and then
DOMDocument
Hello All,I need to take an XML document, modify some of the nodes in it and then perform a selective reordering of a subset of nodes. The modification I have done without too much difficulty -
Need help in log in and log out?
hi there all of u. i have recently created a site for someone. i have placed log in and log out and some links . but those sessions are not working correctly when some one sign in and sign out and
Issues: PHP Forms -Clearing
I've tried looking online before actually asking for help, but I've been looking for about the past 3-5 hours and have found nothing that'll help me.This is a project for school, and well I have to
WM transfer order: confirm different batch than proposed by system
Hi folks,