ashbullmanuk
-
Posts
13 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Downloads
Gallery
Store
Posts posted by ashbullmanuk
-
-
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!
-
i checked out the link, but what i need is that when a user checks a box a whole new section of form appears, with text fields and areas etc.
I dont know much about JS either, so if anyone knows where i might help or a tutorial on this or with PHP would be very much appreciated.
I found a source with what looked like it could do what i want, but the page threw a 500 internal server error when loading the it. the new code if anyone maybe able to shed some light is:
<?php
//Defining checkbox variable
$kick_start = 'unchecked';
if(isset($_POST['continue'])) // the continue button to execute the following
{
if ?(isset($_POST['kick_start']))
{
$kick_start = $_POST['kick_start'];
if ($kick_start == 'yes')
{ include("kick_start_form.html");
}
}
}
?>
Many thanks everyone
-
Hi everyone,
I am trying to add a conditional if statement to a checkbox in an html form, so that when the user checks the box, the a new set of form elements appear below it.
I created the new form elements in a seperate file, and planned on using the include command, so something like:
If ('kick start' == "yes"
{ include ('kickstart.html');}
the html check box code is
Kick Start
nothing happens though when i click the checkbox.
Any thoughts?
-
Incidently the EOD is a way that allows free text within PHP
The PHP heredoc string syntax allows free form text to be used without having to worry about escaping special characters such as quotes and backslashes. The content of the heredoc string is wrapped with <<
The only rules are that the closing EOD; must be at the beginning of the last line, and the only content on that line, as follows:
<?php
$myString = <<
This is some free form text. It can span mutliple
lines and can contain otherwise troublesome characters like
\ and " and ' without causing any problems.
EOD;
?>
So this shouldn't be the issue either, and my host have emailed me to say that as the email actually sends, it isn't an issue with them, however a script issue that is causing an error witin the server!!!
I feel i have experience in banging my head against a concrete wall!!
-
I dont think the comments format ahould make much difference, its just weird that the page only redirects if all the fields are filled in on the form. it sends the email either way, its just the redirection that seems to be a problem. sveral people have looked at it for me and seem to think the code is sound, and that it must be a host issue, preventing it somehow, though i'm not entirely sure why or how!
-
Quite right!! the code for the php is:
<?php
/* Subject and Email Variables */
$email_to = "enquiries@kyu-images.com";
$email_subject = "General Enquiry";
$thankyou_url = "http://www.kyu-images.com/contact-us/email_sent.html";
/* Gathering Data Variables */
$nameField = $_POST["name"];
$email_from = $_POST["email"];
$address1Field = $_POST["address1"];
$address2Field = $_POST["address2"];
$townField = $_POST["town"];
$postcodeField = $_POST["postcode"];
$phoneField = $_POST["phone"];
$serviceField = $_POST["service"];
$brochureField = $_POST["brochure"];
$aboutusField = $_POST["aboutus"];
$oursiteField = $_POST["oursite"];
$commentsField = $_POST["comments"];
$headers = "From: $email_from . \r\n";
$headers .= "Reply-To: $email_from . \r\n";
$headers .= "Content-type: text/html\r\n";
$message = <<
Name: $nameField
Email: $email_from
First Address Line: $address1Field
Second Address Line: $address2Field
Address Town: $townField
Postcode: $postcodeField
Telephone: $phoneField
Service Enquiry: $serviceField
Send Brochure: $brochureField
How Did They Find Us: $aboutusField
Did They Like Our Site: $oursiteField
Client Comments: $commentsField
EOD;
ini_set("sendmail_from", $email_from);
$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.";
}
?>
-
Hi, I am am trying to set up a web site and on the site I have a couple of forms I created in DW, and a PHP script to send the data via email. Easy enough!
However I have an issue, the PHP script will only divert to the success url if the user enters data into all the form elements. However, there are no required fields in the form, the script does send the email irrespective of data input into the form, it just doesn't divert to the success URL.
Can anyone please give me some advice on this????
Thanks in advance!
-
Thank you for your advice Mr Falk, Seem like still more hosting issues then. I will post how it goes with them!
-
Hi, there, I recently posted a topic about my php script not working. That turned out to be a server issue after all - I had to add "ini_set()" and a -f parameter.
However I have now run across another issue. The php script will only divert to the success url, if all the form fields have been entered. If they haven't, the script will still send the email, however it wont divert to the success url. This problem I first noticed when I added the second the form to my website.
This is where it gets a little more confusing. I copied the exact code for the second php processing script, changed the form variables appropriately, changed the email address to post to, and the success page to a different url. Seemed simple enough?
Well it sends the form, but doesn't divert to the success url. I just get that damned 500 - internal error message!
Evan more weirdly (well to me) when I tried to resolve the issue, it prevented the first form from diverting altogether - despite being completely different files, variables and success urls.
So my question is, how does one allow the script to process fully, and divert without needing all the form elements to be filled? And any idea why the second form does not divert at all. I am not sure what the relationship is between the form elements and the scripts ability to divert the to the success page, yet still send the email even without all the form elements being completed!!!!!!
Any help is much appreciated!
The script code for the second form is:
<?php
/* Subject and Email Variables */
$email_to = "conceptarts@kyu-images.com";
$email_subject = "Project Mandate";
$thankyou_url = "http://www.kyu-images.com/contact-us/concept_arts_mandate_form_sent.html";
/* Gathering Data Variables */
$clientnameField = $_POST["clientname"];
$businessnameField = $_POST["businessname"];
$email_from = $_POST["email"];
$phoneField = $_POST["phone"];
$address1Field = $_POST["address1"];
$address2Field = $_POST["address2"];
$townField = $_POST["town"];
$postcodeField = $_POST["postcode"];
$businessField = $_POST["business"];
$productsField = $_POST["products"];
$marketField = $_POST["market"];
$kickstartField = $_POST["kickstart"];
$photographyField = $_POST["photography"];
$termsField = $_POST["terms"];
$webdesignField = $_POST["webdesign"];
$logodesignField = $_POST["logodesign"];
$brandimageField = $_POST["brandimage"];
$mainthemeField = $_POST["maintheme"];
$styles1Field = $_POST["styles1"];
$styles2Field = $_POST["styles2"];
$styles3Field = $_POST["styles3"];
$styles4Field = $_POST["styles14"];
$registerField = $_POST["register"];
$hostingField = $_POST["hosting"];
$pagesField = $_POST["pages"];
$pagenumberField = $_POST["pagenumber"];
$galleryField = $_POST["gallery"];
$gallerynumberField = $_POST["gallerynumber"];
$formsField = $_POST["forms"];
$formnumberField = $_POST["formnumber"];
$filesField = $_POST["files"];
$filenumberField = $_POST["filenumber"];
$regionsField = $_POST["regions"];
$regionnumberField = $_POST["regionnumber"];
$animantionsField = $_POST["animantions"];
$describeField = $_POST["describe"];
$ActivEditingField = $_POST["ActivEditing"];
$databaseField = $_POST["database"];
$detailsField = $_POST["details"];
$usedwhereField = $_POST["usedwhere"];
$addtoField = $_POST["addto"];
$buildonField = $_POST["buildon"];
$purchaseothersField = $_POST["purchaseothers"];
$addprintingField = $_POST["addprinting"];
$graphicsField = $_POST["graphics"];
$dimensionsField = $_POST["dimensions"];
$boxlabeldimensionField = $_POST["boxlabeldimension"];
$headers = "From: $email_from . \r\n";
$headers .= "Reply-To: $email_from . \r\n";
$headers .= "Content-type: text/html\r\n";
$message = <<
Client Name: $clientnameField
Business Name: $businessnameField
Email: $email_from
Telephone: $phoneField
First Address Line: $address1Field
Second Address Line: $address2Field
Address Town: $townField
Postcode: $postcodeField
About Their Business: $businessField
About Their Service/Products: $productsField
About Their Target Market: $marketField
Package For Kick Start Users: $kickstartField
Shoot For Commercial Photography: $photographyField
Terms Agreed: $termsField
Web Design Level: $webdesignField
Logo Design Level: $logodesignField
Brand Image Level: $brandimageField
Main Design Theme: $mainthemeField
Sub Style: $styles1Field
Sub Style: $styles2Field
Sub Style: $styles3Field
Sub Style: $styles4Field
Register Their Site: $registerField
Host Their Site: $hostingField
Add Pages: $pagesField
How Many: $pagenumberField
Add Image Galleries: $galleryField
How Many: $gallerynumberField
Add Online Forms: $formsField
How Many: $formnumberField
Add Downloadable Files: $filesField
How Many: $filenumberField
Add Editable Regions: $regionsField
How Many: $regionnumberField
Add Animations: $animantionsField
What Kind: $describeField
Subscribe To ActivEditing: $ActivEditingField
Create Database: $databaseField
List Of Page Contents: $detailsField
Where Will The Logo Be Used: $usedwhereField
Add designs to Which Services: $addtoField
Build On Existing Designs: $buildonField
Purchase other Concept Designs: $purchaseothersField
Additional Printing Requirements: $addprintingField
What Graphics For Branding: $graphicsField
Flyer, Poster Or Borchure Dimensions And Pages: $dimensionsField
Box Or Label Dimensions: $boxlabeldimensionField
EOD;
ini_set("sendmail_from", $email_from);
$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.";
}
?>
-
Ok I found a script on the net that should send data from any form without knowing much about it, kind of a generic handler. I copied and uploaded, set the form action to follow it, and tested it.
It returned a failed to send message. (the message is coded in the PHP for failure to send the message).
So to it looks more likely an external problem????? The script I tried is:
<?php
if ($_SERVER['REQUEST_METHOD']=="POST"){
// In testing, if you get an Bad referer error
// comment out or remove the next three lines
if (strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])>7 ||
!strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']))
die("Bad referer");
$msg="Values submitted by the user:\n";
foreach($_POST as $key => $val){
if (is_array($val)){
$msg.="Item: $key\n";
foreach($val as $v){
$v = stripslashes($v);
$msg.=" $v\n";
}
} else {
$val = stripslashes($val);
$msg.="$key: $val\n";
}
}
$recipient="enquiries@kyu-images.com";
$subject="General Web Enquiry";
error_reporting(0);
if (mail($recipient, $subject, $msg)){
echo "
Thank you
Message successfully sent:
\n";echo nl2br($input);
} else
echo "An error occurred and the message could not be sent.";
} else
echo "Bad request method";
?>
-
My host did that already and it worked fine - I wondered if it was an issue with the hosts server, but they seem to think the issue must come my side!
-
[ Contact Us ]
Thank your email, it has been successfully sent. We shall soon receive it and will respond as soon as possible.
If your query requires an urgent reply, or you already have a project underway with us, you can email directly to the relevent person:
Concept Arts : conceptarts@kyu-images.com
Web Concepts : webconcepts@kyu-images.com
Photography : photography@kyu-images.com
Enquiries : enquiries@kyu-images.com
Or telephone : 01502 281284 between 09:00 - 18:00 Monday to Friday, and 10:00 - 15:00 Saturday.
Please choose where to go next:
[ Home ]
[ About Us ]
[ Web Design ]
[ Logo Design ]
[ Brand Imaging ]
[ Photography ]
PHP Script / HTML form and Javascript
in PHP
Posted
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:
Yes
No
[ Your Design Requirements ]
Here we will collect information to help us create the designs and styles you want
Contemporary
Traditional
Retro
Classical
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
None
Bronze
Silver
Gold
Platinum
[ Special Offers ]
If you have a special offer discount reference, enter it here
[ Website Design ] [ Logo & Graphic Design ] [ Brand Imaging ]
[ 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
Goal 1:
The ability to:
Goal 2:
The ability to:
Goal 3
The ability to:
The feature:
Design element 1:
The feature:
Design element 2:
The feature:
Design element 3:
www.
.com
.co.uk
Yes Please
No Thanks
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:
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:
I have my own for submission
Use my existing Concept Designs
Please create new designs
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:
I agree.
Please tick to confirm.*