Jump to content

PHP Script / HTML form and Javascript


ashbullmanuk

Recommended Posts

Hi,

a few weeks ago i posted for some help with a form issue i had, where i needed to include or exclude form elements based on the user choices, and javascript was suggested.

I eventually managed to get exactly what i needed to happen work using java, so thank you for your help there, unfortunately that has itself unravelled its own problems.

 

The script only sends the email if the user chooses ALL the elements. If they dont, say they choose only 2 out of 3 services, and 1 stays hidden, i dont receive the email, but the script seems not to have a problem, because it doesn't return any kind of error, and passes the user to the sendmail outcome url - somewhere along the road, it just doesn't send it.

 

One possible answer i think is maybe my host blocks the emails, but why would they!

 

Here is the php code, would it help if i posted the html form code as well?

 

<?php

 

/* Subject and Email Variables */

 

$email_to = "conceptarts@kyu-images.com";

$email_subject = "Online Project Mandate";

$thankyou_url = "email_sent.html";

 

 

/* Gathering Data Variables */

 

$name = $_POST["name"];

$business_name = $_POST["business_name"];

$email_from = $_POST["email"];

$phone = $_POST["phone"];

$address_1 = $_POST["address_1"];

$address_2 = $_POST["address_2"];

$town = $_POST["town"];

$county = $_POST["county"];

$postcode = $_POST["postcode"];

$contact_back = $_POST["contact_back"];

$the_business = $_POST["the_business"];

$the_products = $_POST["the_products"];

$market_demographics = $_POST["market_demographics"];

$commercial_photography = $_POST["commercial_photography"];

$main_theme = $_POST["main_theme"];

$sub_style_1 = $_POST["sub_style_1"];

$sub_style_2 = $_POST["sub_style_2"];

$sub_style_3 = $_POST["sub_style_3"];

$sub_style_4 = $_POST["sub_style_4"];

$use_avoid = $_POST["use_avoid"];

$include_artwork = $_POST["include_artwork"];

$kick_start = $_POST["kick_start"];

$discount_reference = $_POST["discount_reference"];

 

// The next few variables may not appear in the HTML form, as javascript hides these elements if the user does not choose this service

$web_design_level = $_POST["web_design_level"];

$goal_1 = $_POST["goal_1"];

$goal_2 = $_POST["goal_2"];

$goal_3 = $_POST["goal_3"];

$ability_1 = $_POST["ability_1"];

$ability_2 = $_POST["ability_2"];

$ability_3 = $_POST["ability_3"];

$feature_1 = $_POST["feature_1"];

$feature_2 = $_POST["feature_2"];

$feature_3 = $_POST["feature_3"];

$design_1 = $_POST["design_1"];

$design_2 = $_POST["design_2"];

$design_3 = $_POST["design_3"];

$prefered_url = $_POST["prefered_url"];

$url_extension = $_POST["url_extension"];

$register_domain = $_POST["register_domain"];

$add_hosting = $_POST["add_hosting"];

$additional_features = $_POST["additional_features"];

$page_content = $_POST["page_content"];

 

// The next few variables may not appear in the HTML form, as javascript hides these elements if the user does not choose this service

$logo_design_level = $_POST["logo_design_level"];

$logo_used_where = $_POST["logo_used_where"];

$logo_represents = $_POST["logo_represents"];

$current_logos = $_POST["current_logos"];

$purchase_other_concepts = $_POST["purchase_other_concepts"];

 

// The next few variables may not appear in the HTML form, as javascript hides these elements if the user does not choose this service

$brand_image_service_level = $_POST["brand_image_service_level"];

$additonal_printing = $_POST["additonal_printing"];

$art_work_supply = $_POST["art_work_supply"];

$poster_brochure_layout = $_POST["poster_brochure_layout"];

$box_label_dimensions = $_POST["box_label_dimensions"];

$to_advertise = $_POST["to_advertise"];

$advertising_details = $_POST["advertising_details"];

 

// The last variable. Always appears on form. Spry validation to ensure box is checked.

$termsagreed = $_POST["termsagreed"];

// End of variables

 

// Sendmail headers

$headers = "From: $email_from . \r\n";

$headers .= "Reply-To: $email_from . \r\n";

$headers .= "Content-type: text/html\r\n";

 

// the email to be sent

$message = <<

Online Project Mandate

 


 

Personal Information

Client Name: $name

 

Business Name: $business_name

 

Email: $email_from

 

Telephone: $phone

 

First Address Line: $address_1

 

Second Address Line: $address_2

 

Address Town: $town

 

Postcode: $postcode

 

 


 

Business Information

About Their Business: $the_business

 

About Their Service/Products: $the_products

 

About Their Target Market: $market_demographics

 

Add Commercial Photography: $commercial_photography

 

 


 

Design Themes

Main Design Theme: $main_theme

 

Sub Style: $sub_style_1

 

Sub Style: $sub_style_2

 

Sub Style: $sub_style_3

 

Sub Style: $sub_style_4

 

Use\avoid: $use_avoid

 

Include artwork: $include_artwork

 

 


 

Kick Start Package: $kick_start

 

 


 

Special discount reference: $discount_reference

 

 


 

 

// Service option one. HTML form section may or may not be completed based on user choices

 

Website Design

Web design level: $web_design_level

 

Business Goal_1: $goal_1

 

Business Goal_2: $goal_2

 

Business Goal_3: $goal_3

 

Site Ability_1: $ability_1

 

Site Ability_2: $ability_2

 

Site Ability_3: $ability_3

 

Site Feature_1: $feature_1

 

Site Feature_2: $feature_2

 

Site Feature_3: $feature_3

 

Site Design_1: $design_1

 

Site Design_2: $design_2

 

Site Design_3: $design_3

 

Prefered URL: $prefered_url

 

URL Extension: $url_extension

 

Register Domain: $register_domain

 

Add Hosting: $add_hosting

 

Additional Features: $additional_features

 

Page Content: $page_content

 

 


 

 

// Service option two. HTML form section may or may not be completed based on user choices

 

Logo And Graphic Design

Logo Design Level: $logo_design_level

 

Logo Used Where: $logo_used_where

 

Logo Represents: $logo_represents

 

Current Logos: $current_logos

 

Purchase Other Concept Designs: $purchase_other_concepts

 

 


 

 

// Service option three. HTML form section may or may not be completed based on user choices

 

Brand Image

Brand Image Level: $brand_image_service_level

 

Additional Printing: $additonal_printing

 

Artwork Supply: $art_work_supply

 

Poster, Flier, Brochure Dimensions: $poster_brochure_layout

 

Box, Label Dimensions: $box_label_dimensions

 

To Be Advertised: $to_advertise

 

Advertising Details: $advertising_details

 

 


 

Terms Agreed: $termsagreed

 

 


 

EOD;

 

ini_set("sendmail_from", $email_from); //Code required by hosting company

$sent = mail($email_to, $email_subject, $message, $headers, "-f" . $email_from);

 

 

/*Results Rendered As HTML */

 

if($sent) {

header("Location: " . $thankyou_url); // Redirect customer to thankyou page

} else {

// The mail didn't send, display an error.

echo "There has been an error sending your message. Please try later.";

}

 

?>

 

 

 

Thanks for all and any ideas!

Link to comment
Share on other sites





[ Project Mandate Form ]



spacer.gif spacer.gif spacer.gif spacer.gif spacer.gif spacer.gif spacer.gif spacer.gif spacer.gif
Home Website Design Logo Design Brand Image Concept Arts Portfolio Brochure Photography spacer.gif



Welcome to the Kyu Images Project Mandate Form. Please use this form to take on our Corporate Identity services. After receipt of this mandate we will contact you within 24 hourse to book your Concept Arts Consultation.







[ Tell Us ABout You And Your Business ]


Use this section to tell us about you and your business



Your name:



Your business name:




*

Your email:



Your telephone number:



1st Address line:



2nd Address Line:



Town:



County:



Postcode:



Contact Back Time:



Tell us about your business:



And about your products and services:



What are your target market demographics:


Will you require our commercial photography services:




Yes




No





[ Your Design Requirements ]


Here we will collect information to help us create the designs and styles you want


Here we will collect some preliminary details about what kind of styles and images you want for your designs.
( Please choose 1 main theme for your designs. )




Contemporary






Traditional



Retro



Classical
( Now expand your theme by choosing 1 style from each sub category. )




Emotive




Elegant




Intimate




Peaceful




Natural





Conventional




Jazzy




Comical




Cartoon




Advanced





Refined




Simplistic




Rustic




Cosmopolitan




Metropolitan





Gravitas




Industrial




Local




National




International



Are there any colours/ themes we should use or avoid:



Is there any current logo or artwork we should include/ develope:




[ Kick Start ]


Kick Start allows you to mix and match our services to get exactly what you need, with a discount on the total cost



( Please choose your Kick Start Package below, then choose from services below applicable to your package )




None


Bronze

Silver

Gold

Platinum



( If you need one of our services, simply select that service below to continue )


[ Special Offers ]


If you have a special offer discount reference, enter it here




Special offer discount reference:




 



[ Your Website Requirements ]


From this information we will begin designing and constructing your site



Which website design service level do you require:


Choose level...
Level 1
Level 2
Level 3
Level 4

 
Please list the 3 most important business goals for your website e.g. "Increase footfall".
Please list 3 things you want your site to have the ability to do e.g. "Log clients in".

Goal 1:



The ability to:



Goal 2:



The ability to:



Goal 3



The ability to:


What key features would you like to see your site have e.g. "Site searching".

List 3 design elements you would most like to see e.g. "drop down menus".

The feature:



Design element 1:



The feature:



Design element 2:



The feature:



Design element 3:


The URL of your site is it's address, i.e. www.kyu-images.com. What would be your prefered address:

www.






.com




.co.uk

Would yo like us to register your URL (Domain Name):




Yes Please




No Thanks



Would you like us to host your site for ?6pm




Yes Please




No Thanks




Please list any additional features you want included:



Please list any content for specific pages e.g. "3 product pages, and a contact page"






[ Your Logo and Graphic Design ]


This information will help us complete your Logos and Graphics


 

Which Logo and Graphic Design service level will you require:


Choose Level...
Level 1
Level 2
Level 3
Level 4

 

Logos and graphics designed by us can used across our services for websites and brand imaging. If your package includes multiple concept designs, you can purchase the other design in addition to your chosen one for a small fee.


 



Where will your logo or designs be used, e.g. shop front, business cards, stationery or billboards etc:



Should your logo represent you, your business or a specific product/service:



Are there any current logos or designs we should be aware of, use or expand upon:


Will you want to purchase more than 1 Concept Design from your package:




Yes, I do




No thanks







[ Your Brand Imaging and Product Identity ]


Brand Imaging is all about getting your products and services out to clients and potential customers. All our service levels include Level 1 as standard


 

Which Brand Image service level will you require:


Choose Level...
Level 1
Level 2
Level 3
Level 4

 

Are there any additional printing requirements to those supplied:


For your designs, you can use your own designs, your Concept Arts from us, or we can create new ones




I have my own for submission




Use my existing Concept Designs




Please create new designs



Please specify the dimensions/pages of the poster, flier or brochure:


Please specify the dimensions of the box/label to be branded:



Please list what is to be advertised, e.g. a certain product or event:



Please give as much detail about the listed items as you can:





Please check box to confirm you have read and agree to our Terms Of Service as laid out in the [ Important Information ] article.


I agree.
Please tick to confirm.
*


















Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...