473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

PHP multiple fields

OK. First off, let me say I know very little about php. I primarily work in flash and most of the web work I do is informational design and although many of the sites I work on have shopping carts, I do not create them. I use an outsider for that.

I am working on a site in flash that contains multiple input fields so people can send order requests to my client. For instance, she wants their name, email address, phone number, address, as well as numerous questions about the colors, style, etc of the product they are inquiring about. I have managed to set up a base php page that allows for people to send one block of text, but what I need help with is a little different then that. No doubt it would be no problem for ANYONE who knows php but Im totally lost.

What I need to happen is this. I want to set up the fifteen or so input fields. When they fill in all of the fields (each named with specific variable names) and click submit, I want it to send my client an email. In the email, it should say "Name:" followed by whatever they input for the field with a variable name of "name," and continue down the line like that.

Can anyone help me figure out how to do this?
Oct 2 '07 #1
1 1554
Atli
5,058 Expert 4TB
Hi. Welcome to The Scripts!

To do that you could use the mail() function.

You would have to use the $_POST (or $_GET) super-globals to read the input, create the message and send it.

Here is a simple example:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // Make sure the input data was received
  3. if(isset($_POST['Name']) and isset($_POST['Phone'])) {
  4.     // Create the email body
  5.     $name = $_POST['Name'];
  6.     $phone = $_POST['Phone'];
  7.     $body = "This message was sent from a PHP web!\n - Name : $name\n - Phone : $phone";
  8.  
  9.     // Create the email headers
  10.     $to      = 'nobody@example.com';
  11.     $subject = 'Message from PHP web page';
  12.     $headers = 'From: webmaster@example.com' . "\r\n" .
  13.         'Reply-To: webmaster@example.com' . "\r\n" .
  14.         'X-Mailer: PHP/' . phpversion();
  15.  
  16.     // Send the email
  17.     $success = mail($to, $subject, $body, $headers);
  18.  
  19.     // Check if it was sent successfully
  20.     if($success) {
  21.         echo "Message sent!";
  22.     }
  23.     else {
  24.         echo "Failed to send message!";
  25.     }
  26. }
  27. ?>
  28.  
Oct 3 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: shank | last post by:
I have a recordset that contains multiple records of product a user is purchasing. For clarity, I converted the recordset fields to variables. I need to take that entire recordset and insert it...
7
by: Drew | last post by:
I have a db table like the following, UID, int auto-increment RegNo Person Relation YearsKnown Now here is some sample data from this table,
11
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my...
2
by: Will | last post by:
I have a table, tblManinstructions with fields Code & InstructionID, one Code can have many InstructionID. I also have tblinstructions (fields instructionID & instruction). What I want to do is...
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
8
by: preeny8 | last post by:
Hi guys, So I'm editing an existing database (Access 2003), and I need a bit of help in making a validation rule. My table has many fields, 3 of which are indexed (location, number & revision) ...
2
by: Nathan Sokalski | last post by:
I have a Repeater that uses a DataSource that has multiple fields. When the values of these fields is displayed in the Repeater, there are fields that are used in combination with other fields as...
92
by: bonneylake | last post by:
Hey Everyone, Well i was hoping someone could explain the best way i could go about this. i have a few ideas on how i could go about this but i am just not sure if it would work. Right now i...
58
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also...
482
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.