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
Appending GET data with form submition
Okay, what I'm trying to do is to use a form to append an already existing GET data string.It goes something like this:REQUEST_URI="/page.php?var1=foo&var2=bar"Now, what I want to do
$_POST variable un-useable
I'm trying to use a $_POST variable in a mysql update statement but i can't use it for some unknown reason i can echo the variable and it outputs the correct value but i cannot use that variable in
How can i steam a video on my PHP site? (non YouTube)
Basically I have a PHP site and don't want to give page rank to YouTube. I just want to stream a basic video. If you know of any methods, please list file types those methods allow, the more the
Recording popularity by day, week.. all time?
Hey everyone, I'm creating a site designed around users uploading music. How can I implement a system that would effectively record information such as view count so that a user could find the most
Syntax Help
Code: im having trouble with that code snippedParse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
Please help - should be a simple fix.. driving me nuts
Everything seemed to be working fine. I have a table, it alphabetically lists a bunch of cities and relivant city data.However, I found out that the city is showing up only one time when I have can
Grouping and sorting results
Please help with this query.I have 2 tables in a database, countires and cities. states looks like thiscountriesid -----------country1 ------------uk2 ------------us3 ------------japancitiesid
login box shows up again after logging in 2nd login works
Hello,I am having trouble on my site Lockerz.rack111.com where when you login the login box when you hit submit clears and then when you type your info in again then the login box works.here is the
Dynamically allocating the number of rows in a table based on a variable value
Hi, I have situation here which i cannot resolve, I have a variable temp which stores the number of rows in a array for example temp=5 which is calculated based on other values in my table( so temp
Multiple websites question.
Hi, does php have any functionality that enables a programmer to extract information from a website on the internet and display it on their own? Any help or suggestions on where to go and look for a