Php form processing script
Hi. I got a program to write a php form processing script. My submit form is for photo submission to my domain email. I published to site and did a test to see if it works i got this error:
Warning: require_once(F:\Domains\mydomain\mydomain.com\wwwroot/includes/Upload_Photos-lib.php): failed to open stream: No such file or directory in F:\Domains\mydomain\mydomain.com\wwwroot\Upload_Photos.php on line 24 Fatal error: require_once(): Failed opening required 'F:\Domains\mydomain\mydomain.com\wwwroot/includes/Upload_Photos-lib.php' (include_path='.;C:\php\pear') in F:\Domains\mydomain\mydomain.com\wwwroot\Upload_Photos.php on line 24
What does this mean? How can i solve this so that i can process my form?
See if the below form helps: You need to create a folder on your server named - upload - this is where any files uploaded will be stored (make sure the folder is writable. Also change the email address where the information that someone who has uploaded a file will go to. Look for the following in the code: $to ="XXXXXXXXXXXX.com";
<!DOCTYPE html>
<head>
<meta charset="UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
#wrapper {
width: 400px;
margin: 0 auto;
</style>
</head>
<body>
<div id="wrapper">
<?php if(isset($_POST['submit'])) {
$name = trim($_POST['name']);
if(empty($name)) {
$error['name'] = "Please provide your name";
$location = trim($_POST['location']);
if(empty($location)) {
$error['location'] = "Please provide your location";
$email = trim($_POST['email']);
if(empty($email)) {
$error['email'] = "Please provide your email";
$category_description = trim($_POST['category_description']);
if(empty($category_description)) {
$error['category_description'] = "Please provide the category or description";
$terms_conditions = trim($_POST['terms_conditions']);
if(empty($terms_conditions)) {
$error['terms_conditions'] = "Please accept the terms & conditions";
$allowedExts = array(
"doc",
"docx",
"rtf",
"txt",
"pdf",
"jpeg",
"jpg",
$allowedMimeTypes = array(
'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/rtf',
'application/x-rtf',
'text/richtext',
'text/rtf',
'application/plain',
'application/pdf',
'image/gif',
'image/jpeg',
$extension = end(explode(".", $_FILES["file"]["name"]));
if (empty($_FILES["file"]["name"])) {
$selectFile = 'Please select a file to upload';
elseif ( ! ( in_array($extension, $allowedExts ) ) ) {
$fileTypeNotAllowed = 'File type not allowed';
elseif ($_FILES["file"]["size"] > 2097152) {
$fileTooLarge = 'Please provide a smaller file';
elseif (file_exists("upload/" . $_FILES["file"]["name"])) {
$fileExists = $_FILES["file"]["name"] . " already exists, Please change the file name ";
elseif (in_array( $_FILES["file"]["type"], $allowedMimeTypes ) )
if(!empty($_POST['terms_conditions'])) {
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]);
$fileName = $_FILES["file"]["name"];
$fileUploadSuccessful = 'File uploaded successfully';
$to = "XXXXXXXXXXXXX.com";
$subject = "Upload to website";
$headers = "From: $email\r\n";
$headers .= "Reply-To: $email\r\n";
$message = "Name: $name\n\n";
$message .= "Location: $location\n\n";
$message .= "Email Address: $email\n\n";
$message .= "Category/Description: $category_description\n\n";
$message .= "File: $fileName\n\n";
mail($to, $subject, $message, $headers);
$sent = "Mail was sent successfully";
?>
<h1>Form</h1>
<?php
foreach ($error as $value) {
echo "<p>".$value."</p>";
if(isset($formFieldError)) {
echo "<p>".$formFieldError."</p>";
if(isset($selectFile)) {
echo "<p>".$selectFile."</p>";
if(isset($fileTypeNotAllowed)) {
echo "<p>".$fileTypeNotAllowed."</p>";
if(isset($fileTooLarge)) {
echo "<p>".$fileTooLarge."</p>";
if(isset($fileExists)) {
echo "<p>".$fileExists."</p>";
if(isset($fileUploadSuccessful)) {
echo "<p>".$fileUploadSuccessful."</p>";
?>
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<p>
<label for="name">Name<br>
<input type="text" name="name" id="name" value="<?php if(isset($name)) {echo $name; } ?>"/>
</label>
</p>
<p>
<label for="location">Location<br>
<input type="text" name="location" id="location" value="<?php if(isset($location)) {echo $location; } ?>"/>
</label>
</p>
<p>
<label for="email">Email<br>
<input type="text" name="email" id="email" value="<?php if(isset($email)) {echo $email; } ?>" />
</label>
</p>
<p>
<label for="category_description">Category and Description<br>
<input type="text" name="category_description" id="category_description" value="<?php if(isset($category_description)) {echo $category_description; } ?>" />
</label>
</p>
<p>
<label for="file">File Attachment:<br>
<input type="file" name="file" id="file" />
</label>
</p>
<p>
<label for="terms_conditions">Terms & Conditions:
<input name="terms_conditions" type="checkbox" value="accept" <?php if(isset($_POST['terms_conditions'])) {echo "checked"; } ?>> (Please check)
</label>
</p>
<input type="submit" name="submit" value="Submit" />
</form>
</div>
</body>
</html>
Similar Messages
-
Hi all
would someone beable to help?
I have been using a free php form data script on my website but I am finding that when people fill in the form that not all the form submissions are getting through and I am not sure if it is the php form script
Would any one be to direct me to a good free php data script that is simple to use
many thanks for your help!hi there
many thanks for your help!
ok, am little new to this, so do you mean in my contact.php script I have?
not sure what I would be looking for?
I tried to attach to this post but copuld so zipped it for download here; http://www.thevineproject.org.uk/contact.zip
thanks for your help -
What is a good resource for pre-made PHP Form Mailer Scripts.
This is for use with a website hosted on GoDaddy.
My client has a few requirements that the GoDaddy script does
not offer (and the script I chose from GoDaddy is uneditable). I
know nothing about scripting but thought I could use a pre-made
script and modify it...is that crazy thinking on my part?
Here are the special requests from my client:
- They'd like to see the time the form was submitted in EST
(the GoDaddy script puts the time in military time in another time
zone in the subject line). Can this appear in the body of the email
as well as the subject line?
- They'd like the form to be sent to the person submitting it
as well as to their company
- They would like to be able to REPLY TO the email they
receive with the form submission and have it be addressed to the
person submitting the form. The current script has the email
addressed to themselves (the company) if they click REPLY TO, so
they are replying to themselves
- Although this has nothing to do with the Form Mailer script
as far as I can guess, they asked that the person filling out the
form be able to print it prior to submitting (in my opinion,
though, if i can have a copy of the submission sent to the
submitter, there's no reason for this). But if anyone knows how to
do this, please let me know.
- Finally, the client wants to know if each submission can
have a unique tracking number assigned to it.
Thank you all. Any feedback is appreciated.
RichardHi,
I can without any doubt recommend Forms 2 Go:
http://www.bebosoft.com/products/formstogo/index.php
Very easy to use and even someone like me who don't know a
lot of
programming, use it extensively.
Deon
"RichyZee" <[email protected]> wrote in
news:gcvkac$fcp$[email protected]:
> What is a good resource for pre-made PHP Form Mailer
Scripts. This is
> for use with a website hosted on GoDaddy.
>
> My client has a few requirements that the GoDaddy script
does not
> offer (and
> the script I chose from GoDaddy is uneditable). I know
nothing about
> scripting but thought I could use a pre-made script and
modify it...is
> that crazy thinking on my part?
>
> Here are the special requests from my client:
>
> - They'd like to see the time the form was submitted in
EST (the
> GoDaddy
> script puts the time in military time in another time
zone in the
> subject line). Can this appear in the body of the email
as well as the
> subject line?
>
> - They'd like the form to be sent to the person
submitting it as well
> as to
> their company
>
> - They would like to be able to REPLY TO the email they
receive with
> the form
> submission and have it be addressed to the person
submitting the form.
> The current script has the email addressed to themselves
(the company)
> if they click REPLY TO, so they are replying to
themselves
>
> - Although this has nothing to do with the Form Mailer
script as far
> as I can
> guess, they asked that the person filling out the form
be able to
> print it prior to submitting (in my opinion, though, if
i can have a
> copy of the submission sent to the submitter, there's no
reason for
> this). But if anyone knows how to do this, please let me
know.
>
> - Finally, the client wants to know if each submission
can have a
> unique
> tracking number assigned to it.
>
> Thank you all. Any feedback is appreciated.
>
> Richard
>
> -
Hi
I'm tring to adapt a form processing script that appears in
the book "PHP Web Development with Macromedia Dreamweaver MX 2004"
published by Apress. The example in the book has a simple form
containing a "comments" field and a "email" and "confirm your
email" fields. The script works fine but the form I need has a few
more fields. ie. "name" and "telephone". How can I alter the
attached script so that the contents of these extra fields are sent
along with the rest of the email?
Thanks for your help!After
if (isset($_POST['comments']) &&
!empty($_POST['comments'])) {
$message=strip_tags($_POST['comments']);
else {
$nomessage = 'You have not entered any comments';
And using the same syntax as above add:
if (isset($_POST['name']) && !empty($_POST['name']))
$message .= "\n";
$message .= "Name: " . strip_tags($_POST['name']);
if (isset($_POST['telephone']) &&
!empty($_POST['telephone'])) {
$message .= "\n";
$message .= "Telephone: " . strip_tags($_POST['telephone']);
\n is the newline character for emails
Gareth
http://www.phploginsuite.co.uk/
PHP Login Suite V2 - 34 Server Behaviors to build a complete
Login system. -
i'm creating an inquiry form for a client hosting w/godaddy.
Site is in DW using godaddy's php form mail script. script
works fine for sending formmail.
Is it possible to validate form fields in php? the customer
wants to have the first name, email address, etc. being a required
field or the form will not submit. godaddy support is clueless,
they e-mailed a kb article on changing the form e-mail address as a
solution.
can anyone provide insight? thanx in advance!Sure it is. It's even possible to do it in javascript before
the form gets
submitted.
Which DW are you using?
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"donna_d" <[email protected]> wrote in
message
news:fn8468$r4n$[email protected]..
> i'm creating an inquiry form for a client hosting
w/godaddy.
> Site is in DW using godaddy's php form mail script.
script works fine for
> sending formmail.
>
> Is it possible to validate form fields in php? the
customer wants to have
> the
> first name, email address, etc. being a required field
or the form will
> not
> submit. godaddy support is clueless, they e-mailed a kb
article on
> changing
> the form e-mail address as a solution.
>
> can anyone provide insight? thanx in advance!
> -
I'm looking suggestions for a drop-in PHP form emailer
script... something that I can either configure by using templates
that are unique to each form or some other method of per-form
configurability.
I'm using soupermail.pl now, but would like to move away from
it because it has issues with certain users who use AOL and have
Norton security products (they will receive errors when submitting
the form).
I do not want to write a generic form mailer from scratch, as
I am not comfortable with ensuring that it is safe from spammers...
I would like to find something that I can use from several forms on
my site. I do not need to write anything to a database, just be
able to email to variable destination email accounts. I do not want
to be able to upload or send attachments.
Thanks for any suggestions.Hi there - read my article titled, "Validating your forms
with PHP" - here:
http://sourtea.com/articles.php
At the end of the article, I provide the full, free code to
do what you're
looking for.
HTH, take care.
Shane H
[email protected]
http://www.avenuedesigners.com
=============================================
Web Dev Articles, Photography, and more:
http://sourtea.com
=============================================
Proud GAWDS Member
http://www.gawds.org/showmember.php?memberid=1495
Delivering accessible websites to all ...
=============================================
"JillTW" <[email protected]> wrote in
message
news:eeebap$q71$[email protected]..
> I'm looking suggestions for a drop-in PHP form emailer
script... something
> that
> I can either configure by using templates that are
unique to each form or
> some
> other method of per-form configurability.
>
> I'm using soupermail.pl now, but would like to move away
from it because
> it
> has issues with certain users who use AOL and have
Norton security
> products
> (they will receive errors when submitting the form).
>
> I do not want to write a generic form mailer from
scratch, as I am not
> comfortable with ensuring that it is safe from
spammers... I would like to
> find
> something that I can use from several forms on my site.
I do not need to
> write
> anything to a database, just be able to email to
variable destination
> email
> accounts. I do not want to be able to upload or send
attachments.
>
> Thanks for any suggestions.
> -
How to stop form processing in script at certain condition
Hi,
I need to stop sap script form processing at a certain conditon. E.g., if there are 3 or less items to be printed it should not print the form at all. Since im using standard print pgm i can make changes only in form. Is there any command in (like stop or exit) script to do so? please let me know.
Rgds
sudhanshuYou can create a output control requirement in the transaction VOFM and attach the requirement to the condition type in an output procedure or to an individual access in an access sequence.
What you can do in this requirement routine is set sy-subrc to 4 if the condition is not met and 0 otherwise.
Your functional consultant should be able to help you with this.
regards,
Advait -
Helo,
I am running Windows XP Pro.
What Are the Internet Browser Setting that can Stops my form''s data from being received as emails.
The Form Date is Received into Selected Email Boxes When the Form is Filled Out from Other PCs.
http://www.collegestudentvoice.com/form.php
1. All Emails boxes are set up.
2. Have turned OFF NetworkSolution Firewall.
3. Firefox http referer is SET to 2.
4. Form generated NO ERRORS when I fill it out.
cheers,
Dreamweaver101.1Hello,
The problem may be in a script but I also believe it has to do with my browser settings.
How else to explain that the form's data is NOT received from my laptop but is received from pc of my friend in LA and the form developer's pc.???
There three files that deal with the form email script:
1. http://www.collegestudentvoice.com/form.php
2. http://www.collegestudentvoice.com/send-email-form.php
3 FORM ACTION.PHP File :
<?php
require_once('recaptchalib.php');
$privatekey = "6LfwwsISAAAAAAPShkJ6nV3qkgLDHCe2uXj9RTWw";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
else {
include_once('Mail.php');
include_once('Mail/mime.php');
$errors ='';
$max_allowed_file_size = 10000000; // size in KB
$allowed_extensions = array("jpg", "jpeg", "gif", "bmp");
$upload_folder = 'files/';
$name_of_uploaded_file = basename($_FILES['uploaded_file']['name']);
$type_of_uploaded_file = substr($name_of_uploaded_file,
strrpos($name_of_uploaded_file, '.') + 1);
$size_of_uploaded_file = $_FILES["uploaded_file"]["size"]/1024;
if($size_of_uploaded_file > $max_allowed_file_size )
$errors .= "\n Size of file should be less than $max_allowed_file_size";
$allowed_ext = false;
for($i=0; $i<sizeof($allowed_extensions); $i++)
if(strcasecmp($allowed_extensions[$i],$type_of_uploaded_file) == 0)
$allowed_ext = true;
if(!$allowed_ext)
$errors .= "\n The uploaded file is not supported file type. ".
" Only the following file types are supported: ".implode(',',$allowed_extensions);
if(empty($errors))
$path_of_uploaded_file = $upload_folder . $name_of_uploaded_file;
$tmp_path = $_FILES["uploaded_file"]["tmp_name"];
if(is_uploaded_file($tmp_path))
if(!copy($tmp_path,$path_of_uploaded_file))
$errors .= '\n error while copying the uploaded file';
$Business = Trim(stripslashes($_POST['Business']));
$ProfessionalSports = Trim(stripslashes($_POST['ProfessionalSports']));
$Humor101 = Trim(stripslashes($_POST['Humor101']));
$CollegeSports = Trim(stripslashes($_POST['CollegeSports']));
$Politics = Trim(stripslashes($_POST['Politics']));
$EmailToBusiness = $Business . "@collegestudentvoice.net";
$EmailToProfessionalSports = $ProfessionalSports . "@collegestudentvoice.net";
$EmailToHumor101 = $Humor101 ."@collegestudentvoice.net";
$EmailToCollegeSports = $CollegeSports . "@collegestudentvoice.net";
$EmailToPolitics = $Politics . "@collegestudentvoice.net";
$EmailTo = "[email protected]";
$EMailSubject = Trim(stripslashes($_POST['Subject']));
$First = Trim(stripslashes($_POST['First']));
$Last = Trim(stripslashes($_POST['Last']));
$Email = Trim(stripslashes($_POST['Email']));
$Suggestions = Trim(stripslashes($_POST['Suggestions']));
$Body = "The following form has been filled";
$Body .= "\n";
$Body .= "---------------------------------------------------------------------------------";
$Body .= "\n";
$Body .= "\n";
$Body .= "First Name: ";
$Body .= $First;
$Body .= "\n";
$Body .= "Last Name: ";
$Body .= $Last;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Business: ";
$Body .= $Business;
$Body .= "\n";
$Body .= "Professional Sports: ";
$Body .= $ProfessionalSports;
$Body .= "\n";
$Body .= "Humor 101: ";
$Body .= $Humor101;
$Body .= "\n";
$Body .= "College Sports: ";
$Body .= $CollegeSports;
$Body .= "\n";
$Body .= "Politics: ";
$Body .= $Politics;
$Body .= "\n";
$Body .= "Suggestions: ";
$Body .= $Suggestions;
$Body .= "\n";
$Body .= "\n";
$Body .= "---------------------------------------------------------------------------------\n";
$Body .= "Emails sent to: " . strtolower($EmailToBusiness) . " / " .strtolower($EmailToProfessionalSports). " / " .strtolower($EmailToHumor101). " / " .strtolower($EmailToCollegeSports). " / ".strtolower($EmailToPolitics). "";
$to = "[email protected]";
$subject= $EMailSubject;
$from = "[email protected]";
$text = "\n $Body";
$message = new Mail_mime();
$message->setTXTBody($text);
$message->addAttachment($path_of_uploaded_file);
$body = $message->get();
$extraheaders = array("From"=>$from, "Subject"=>$subject,"Reply-To"=>$Email);
$headers = $message->headers($extraheaders);
$mail = Mail::factory("mail");
$mail->send($to, $headers, $body);
if ($Business != "")
$mail->send(strtolower($EmailToBusiness), $headers, $body);
if ($ProfessionalSports != "")
$mail->send(strtolower($EmailToProfessionalSports), $headers, $body);
if ($Humor101 != "")
$mail->send(strtolower($EmailToHumor101), $headers, $body);
if ($CollegeSports != "")
$mail->send(strtolower($EmailToCollegeSports), $headers, $body);
if ($Politics != "")
$mail->send(strtolower($EmailToPolitics), $headers, $body);
print "<meta http-equiv=\"refresh\" content=\"0;URL=form.php?suc=y\">";
?> -
Need help with PHP form processor coding
I posted my first question on this forum earlier today and got help quickly. I'm going to try again and see who can help me this time.
I have a customer feedback form that I designed and I am using Spry validation on the fields and I'm use Recaptcha as well. Now I'm trying to get the form handler working. I know there are some canned procedures out there but I hate using too much code that I don't understand at all. I'm sure my first attempt at PHP coding is horrible but we all have to learn. My processor is working in some areas but there are holes I don't know how to fill in:
1. When I validate the Recaptcha input, if it was entered correctly, I go on to send an email to the appropriate person BUT how do I send them a message and get back to the form if the recaptcha validation fails and still have their entries in place?
2. Assuming the recaptcha validated correctly, my procedure sends an email and it writes the comments to a file for historical purposes. These parts seem to be working (by some miracle). Once I do this, I think I would like to open a little window to send the customer a confirmation message, have them click the box to confirm and close the window and then take them back to the feedback form but now have it be reset. I'm not sure how to do these steps.
Does anyone have a SIMPLE example to accomplish these steps?
Thanks much!!
DonnaIt would be hard to give you substantive examples of how to accomplish your goals here without seeing your PHP code, but in general the following methods would work:
1. To return to the form with the fields populated, is easiest when the processing script and the form code are on the same page. The idea is that when the form is not properly completed, you fall back into the form code and use the data from the posted values to repopulate the fields, e.g.,
<input type="text' name="whatever" value="<?php isset($_POST['whatever']) { echo $_POST['whatever']; ?>">
or
<select name="whatever2">
<option<?php if(isset($_POST['whatever2']) && $_POST['whatever2']=='this_option_value') { echo ' selected="selected"'; } ?>>this_option_value</option>
</select>
Each field is set to repeat the posted data (if the corresponding $_POST value is set - to avoid error messages when the page is first loaded).
2. You can place the confirmation message on the page with CSS that hides it. When the form is submitted successfully, just set a variable that is used to show the previously hidden message, e.g.,
Assume the following CSS -
#message { display:none; }
and the following HTML -
<p id="message">Congratulations</p>
and the fact that you have set a PHP variable called $success to be true when the form is successfully submitted, you would just modify the HTML like this -
<p id="message"<?php if($success) { echo ' style="display:block"; } ?>>Congratulations</p>
Make sense? -
I am a new web designer who is not code savey yet. Anyway
during the various sites i have designed i have used 3 different
forms that process and email it to me using a seperate php form, 1
in flash, 2 from a standard html form on a windows server. All have
been uploaded, to the site, tested and worked fine. 2 are in old
sites, one in my current site. Recently all 3 forms stopped working
and while they looked like they worked fine they no longer actually
sent anything. I had a big email arguement with my host and finally
they added this line into my php script "ini_set
("sendmail_from","[email protected]");" email address is example here
and they added another form to my site called "php4-cgi-fcgi.ini."
Then my curent form started working again. I haven't changed
anything, and of course the host never informed me of any changes.
So why did this need to be added for my form to work again? Does
this mean they upgraded to another version or something? Ihad a big
arguement with them because they refused to tell me what they did
that stopped all my forms from working, they kept acting like it
was me or my provider that caused the problem, when i am positive
we were not the problem. Any thoughts?doing a google on "ini_set ("sendmail_from" gives a lot of
info.
summary- the form script you are using is probably not
setting a default
"FROM" email address, so the host has phpmail() reject it as
possible spam
abuse.
The .ini files the host added to your site correct the
problem. They change
values for php to use within your hosting domain.
What php script are you using to send the emails? It is
probably out of date
if it doesn't address this issue.
Off Topic: suggest never arguing with hosting support. Even
it the person at
the other end of the phone is an 18 year old drone not
earning their salt.
Move the site if needed. Develop social engineering skills to
get things
done.
Alan
Adobe Community Expert, dreamweaver
http://www.adobe.com/communities/experts/ -
I am trying to create a php form and I can get it to spit out the information from the form but I cannot seem to get it to send the result as an email.
This is probably something really simple and I am totally missing it.
Here is the form:
<form method="post" action="sendail.php">
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
<p>I need:<span class="redStar">*</span>
<input type= "radio" name = "need" value = "service" />service.
<input type= "radio" name = "need" value = "sales" />to contact a salesperson.
<input type= "radio" name = "need" value = "literature" />to have literature sent to me.<br />
Name: <input type = "text" name = "name" size = "30" />
<span class="redStar">*</span><br />
Title: <input type = "text" name = "title" size = "30" /><br />
Company: <input type = "text" name = "company" size = "30" /></p>
<p>Address 1: <input type = "text" name = "address1" size = "30" />
<span class="redStar">*</span><br />
Address 2: <input type = "text" name = "address2" size = "30" /><br />
City: <input type = "text" name = "city" size = "30" />
<span class="redStar">*</span> State: <input type = "text" name = "state" size = "3" />
<span class="redStar">*</span> Zip: <input type = "text" name = "zip" size = "11" />
<span class="redStar">*</span></p>
<p>Email: <input type = "text" name = "email" size = "30" />
<span class="redStar">*</span><br />
Phone: <input type = "text" name = "phone" size = "30" />
<span class="redStar">*</span> </p>
<p><input type = "submit" name = "submit" value = "Submit" /></p>
<p><span class="redStar">*</span> These blanks must be filled in</p>
</form>
and here is the page that handles the form (with the exception of the referring page, and other environmentals:
<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$need = $_POST['need'];
$name = $_POST['name'];
$title = $_POST['title'];
$company = $_POST['company'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$email = $_POST['email'];
$phone = $_POST['phone'];
if(!$email == "" && (!strstr($email,"@") || !strstr($email,".")))
echo "<h2>Use Back - Enter valid email</h2>\n";
$badinput = "<h2>Your form was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
if(empty($name) || empty($email) || empty($address1) || empty($city) || empty($state) || empty($zip) || empty($phone)) {
echo "<h2>Use your Back button - fill in all starred fields, your form was not submitted.</h2>\n";
die ("Use back! ! ");
$todayis = date("l, F j, Y, g:i a") ;
$subject = Contact_From_Website;
$message = " $todayis [EST] \n
From: $name ($email)\n
Title: $title\n
Company: $company\n
Telephone: $phone ($phone)\n
Address: $address1\n
$address2\n
City: $city\n
State: $state\n
Zip: $zip\n
Phone: $phone\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
$from = "From: $email\r\n";
mail("[email protected]", $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
/* This is the part that emails everyone and is commented out for testing
if ($need = "service") {
mail("[email protected]", $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
mail("[email protected]", $need, $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
if ($need = "sales") {
mail("[email protected]", $need, $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
mail("[email protected]", $need, $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
if ($need = "literature") {
mail("[email protected]", $need, $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
mail("[email protected]", $need, $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
?>
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $name ?> ( <?php echo $email ?> ) <?php echo $title ?> <?php echo $company ?> <?php echo $phone ?> <?php echo $address1 ?> <?php echo $address2 ?> <?php echo $city ?> <?php echo $state ?> <?php echo $zip ?>
<br /> You have requested <?php echo $need ?>
<br /> Your IP Address has been recorded for your safety.
<?php echo $ip ?>
You can see where I am trying to go with this. I want to use the $need variable to determine where the email is going to go (two people in each case). But I am testing this script and cannot get to send me an email without any if statements.
Where have I gone wrong?60251977 wrote:
> I'm considering switching to Wordpress but have started
building a site in
> Dreamweaver, and am not especially keen on having to
learn an entirely new
> program.
If you're not keen on learning, you might want to reconsider
your plans.
Creating a simple web page is easy, giving many beginners the
false
impression that website development is something anyone can
do without
acquiring specialist knowledge.
> I want to create a simple "Add Comment" form so that
when a visitor to my site
> wants to comment, he can do so, press submit, and the
page refreshes with his
> comments inserted. Just like a blog.
Yep, sounds simple enough, but so is turning the ignition key
of a car.
What you're ignoring is the underlying technology that not
only makes it
work, but makes it work safely. WordPress does all of this
for you
straight out of the box. To build it successfully in
Dreamweaver
requires a knowledge of PHP, MySQL, and SQL.
> According to the Pickaweb FAQ, the path to PHP is
"/usr/bin/php"
If PHP is enabled on your site, the path to PHP is
irrelevant.
> If my site was called elephantlike.co.uk, what would I
enter into the Action
> field of the form wizard?
> Would this make my form work? Or is there other stuff I
need to know?
What you enter in the Action field is the path to the script
that
processes the form input. If you're willing to learn the
basics of PHP,
MySQL, and SQL, you can create a comment form on your site
with
Dreamweaver. However, you need to be aware of security
issues, such as
cross-site scripting and dealing with spam. What looks simple
at first
glance is actually more complex. It's not rocket science, but
it does
involve a learning curve.
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS4",
"PHP Solutions" & "PHP Object-Oriented Solutions"
http://foundationphp.com/ -
I have a very basic PHP form coded and whenever I look at it in Live View the bottom third of the processing code appears at the top of the webpage. Uploaded the code does not appear on the webpage and the form works fine, except that the dropdown initial values I have set are ignored.
The form URL: http://affordableroofingcontractors.com/contact-us.php
The dropdown code: (I want "select one" displayed but the form shows "Re-roofing" instead!?)
<select name="service" id="service">
<option value="0" selected="selected"
<?php if (!$_POST ||$_POST['service'] =='0') {
echo 'selected="selected"'; }?>>--select one--</option>
<option value="Proactive Roof Maintenance"
<?php if (!$_POST ||$_POST['service'] =='Proactive Roof Maintenance') {
echo 'selected="selected"'; }?>>Proactive Roof Maintenance</option>
<option value="Roof Repairs"
<?php if (!$_POST ||$_POST['service'] =='Roof Repairs') {
echo 'selected="selected"'; }?>>Roof Repairs</option>
<option value="Re-roofing"
<?php if (!$_POST ||$_POST['service'] =='Re-roofing') {
echo 'selected="selected"'; }?>>Re-roofing</option>
</select>
The processing code:
<?php
if (array_key_exists('submit', $_POST)){
//mail processing script
// remove escape characters from POST array
if (PHP_VERSION < 6 && get_magic_quotes_gpc()) {
function stripslashes_deep($value) {
$value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
return $value;
$_POST = array_map('stripslashes_deep', $_POST);
if (!empty($_POST['area'])) {
$to = '[email protected]';
$subject = 'SUSPECTED BOT SUBMISSION from ACI quote form';
} else {
$to = '[email protected]';
$subject = 'ACI CONTACT FORM';
//list expected fields
$expected = array('name','company','phone','email','service','building','comments');
//set required fields
$required = array('name','email','phone');
//create empty array for any missing fields
$missing = array();
//assume there is nothing suspect
$suspect = false;
//create a pattern to locate suspect phrases
$pattern = '/Content-Type:|Bcc:|Cc:/i';
// function to check for suspect phrases
function isSuspect($val, $pattern, &$suspect) {
// if the variable is an array, loop through each element and pass it recursively back to the same function
if (is_array($val)) {
foreach ($val as $item) {
isSuspect($item, $pattern, $suspect);
else {
// if one of the suspect phrases is found, set Boolean to true
if (preg_match($pattern, $val)) {
$suspect = true;
//check the Post array and any subarrays for suspect content
isSuspect($_POST, $pattern, $suspect);
if ($suspect) {
$mailSent = false;
unset($missing);
} else {
//process POST variables
foreach ($_POST as $key => $value){
//assign to temporary variable and strip whitespace if not an array
$temp = is_array($value) ? $value : trim($value);
//if empty and required, add to $missing array
if (empty($temp) && in_array($key, $required)) {
array_push($missing, $key);
} elseif (in_array($key, $expected)) {
//otherwise, assign to a variable of the same name as $key
${$key} = $temp;
//validate the email address
if (!empty($email)) {
// regex to identify illegal characters in email address
$checkEmail = '/^[^@]+@[^\s\r\n\'";,@%]+$/';
//reject the email address if it doesn't match
if (!preg_match($checkEmail, $email)){
$suspect = true;
$mailSent = false;
unset($missing);
//go ahead only if not suspect and all required fields OK
if (!$suspect && empty($missing)) {
//build the message
$message = "Name: $name\r\n\r\n";
$message .= "Company: $company\r\n\r\n";
$message .= "Phone: $phone\r\n\r\n";
$message .= "Email: $email\r\n\r\n";
$message .= "Service Needed: $service\r\n\r\n";
$message .= "Type of Building: $building\r\n\r\n";
$message .= "Comments: $comments";
//limit line length to 70 characters
$message = wordwrap($message, 70);
//create additional headers
$headers = "From: $email>\r\n";
$headers .= 'Content-Type: text/plain; charset=utf-8';
if (!empty($email)) {
$headers .= "\r\nReply-To: $email";
//send it
$mailSent = mail($to, $subject, $message, $headers);
if ($mailSent) {
//$missing is no longer needed if email is sent, so unset it
unset($missing);
?>Hi!
To select php form you should create a menu, fill out the type of "choice of one item of many" or "Select multiple items from the many." Must be inside FORM element and have at the start or end tags. It contains several elements OPTION, otherwise it makes no sense.
Example:
<HTML> <body>
<form method='post' action='all.php'>
Color Scheme: <br>
<SELECT NAME="color">
<OPTION VALUE="Standard" SELECTED> </ OPTION>
<OPTION VALUE='Brick'> Brick </ OPTION>
<OPTION VALUE='Gray Mouse'> Gray Mouse </ OPTION>
<OPTION VALUE='Ship Bottom'> Ship Bottom </ OPTION>
<OPTION VALUE='Black Night'> Black Night </ OPTION>
<OPTION VALUE='White Light'> White Light </ OPTION>
<OPTION VALUE='Yellow List'> Yellow List </ OPTION>
<OPTION VALUE='Pink Myth'> Pink Myth </ OPTION>
<OPTION VALUE='Green USD'> Green USD </ OPTION>
<OPTION VALUE='Standard'> Standard </ OPTION>
</ SELECT>
<input type='submit' name='submit' value='go'>
</ form>
</ body> </ HTML>2 -
Hello Experts,
I am trying to make communication between FMS server and PHP (Linux server). As I am working on a video recording application I want to move the recorded video file from the FMS server to my PHP (Linux server). I am trying to connect to FMS server using rtmp path through PHP script but unable to establish connection.Ben,
At the end of the 29:43 minute Part One video, starting at 28:28 minutes,
he says, "If you are watching this on YouTube there will be a link to click
in the subscription box and it will take you to a web page where you will
be able to download the PHP Java script and form validation processing
scripts you will need to complete Part Two of this tutorial."
So I did all that but could not find the Contact Form Validation download
link! The tutorial is using Dreamweaver CS5 so do you think Adobe deleted
the Contact Form Validation file because it is no longer needed with CS6?
I will see how far I get in Part Two, but let me know if you know what I
should do.
Thank you,
Rick -
Php form, input type country
Is it important to have a country of origin? If so, do I just
type Greece?
<input type=hidden value="GREECE"
name=originating_country>
JoAnd who wrote jomail.php? You? Can you show us the code in
it?
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"josie1one" <[email protected]> wrote in message
news:[email protected]...
> Sorry, should have looked
>
> action="jomail.php"
>
> --
> Jo
>
>
>
> "Murray *ACE*" <[email protected]>
wrote in message
> news:[email protected]...
>>>>"action"
>>>
>>> POST
>>
>> No, that's METHOD. What's the "action" attribute's
value?
>>
>> --
>> Murray --- ICQ 71997575
>> Adobe Community Expert
>> (If you *MUST* email me, don't LAUGH when you do
so!)
>> ==================
>>
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
>>
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
>> ==================
>>
>>
>> "josie1one" <[email protected]> wrote
in message
>> news:[email protected]...
>>> No, no database. Yes, processed to produce a
summary mesage and emailed
>>> to the site's owner. No, the owner isn't asking
for the country of
>>> origin. The purpose is an enquiry form for
holiday apartments to let.
>>>
>>>>"action"
>>>
>>> POST
>>>
>>> --
>>> Jo
>>>
>>>
>>>
>>> "Murray *ACE*"
<[email protected]> wrote in message
>>> news:[email protected]...
>>>> So the form's data is not captured in a
database? It's only processed
>>>> to produce a summary message and emailed to
the site's owner? Is the
>>>> owner asking for the Country of origin?
>>>>
>>>> What is the value of the "action" attribute
of the <form> tag?
>>>>
>>>> --
>>>> Murray --- ICQ 71997575
>>>> Adobe Community Expert
>>>> (If you *MUST* email me, don't LAUGH when
you do so!)
>>>> ==================
>>>>
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
>>>>
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
>>>> ==================
>>>>
>>>>
>>>> "josie1one" <[email protected]>
wrote in message
>>>> news:[email protected]...
>>>>> Thanks for the reference, lovely quote
(o:
>>>>>
>>>>> I guess I don't need that information
but I didn't know if it was
>>>>> needed.
>>>>>> how is that information then
handled?
>>>>>
>>>>> php and erm, passed to a mail handler
which processes a thank you. Is
>>>>> that the correct answer?
>>>>>
>>>>>> By the way, all attribute values
should be in quotes -
>>>>>>
>>>>>> <input type="hidden"....
>>>>>
>>>>> Thank you, I will fix that.
>>>>>
>>>>> --
>>>>> Jo
>>>>>
>>>>>
>>>>>
>>>>> "Murray *ACE*"
<[email protected]> wrote in message
>>>>>
news:[email protected]...
>>>>>> Why are you feeling it would matter.
Do *you* need that information?
>>>>>> If not, then it's like what the
Cheshire Cat said to Alice....
>>>>>>
>>>>>> Alice: [standing at fork in road]
Which way do I go?
>>>>>> Cat: What is your destination?
>>>>>> Alice: It doesn't matter.
>>>>>> Cat: Then it doesn't matter which
way you go!
>>>>>>
>>>>>> Those fields are there only for the
support of the processing script,
>>>>>> and for the way that the information
is handled. What script are you
>>>>>> using and how is that information
then handled?
>>>>>>
>>>>>> By the way, all attribute values
should be in quotes -
>>>>>>
>>>>>> <input type="hidden"....
>>>>>>
>>>>>> --
>>>>>> Murray --- ICQ 71997575
>>>>>> Adobe Community Expert
>>>>>> (If you *MUST* email me, don't LAUGH
when you do so!)
>>>>>> ==================
>>>>>>
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
>>>>>>
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
>>>>>> ==================
>>>>>>
>>>>>>
>>>>>> "josie1one"
<[email protected]> wrote in message
>>>>>>
news:[email protected]...
>>>>>>> Sorry Micha, that wasn't enough
was it?
>>>>>>> It's an input form - I can't
show the link because I have a
>>>>>>> scripting error, but the
relevant lines are these:
>>>>>>>
>>>>>>> <form name="form1"
method="post" action="jomail.php">
>>>>>>> <input type=hidden
value="General Information Request"
>>>>>>> name=mailsubject>
>>>>>>> <input type=hidden
value="kiwiannes-leros.com"
>>>>>>> name=originating_site>
>>>>>>> <input type=hidden value="UK"
name=originating_country>
>>>>>>> <input type=hidden
name="env_report"
>>>>>>>
value="REMOTE_HOST,REMOTE_ADDR">
>>>>>>> <input type=hidden
value="Information Request" name=title>
>>>>>>>
<fieldset><legend><strong>Contact
Form</strong></legend>
>>>>>>>
>>>>>>> line 4 above - the originating
country is Greece. What do I type
>>>>>>> please? GR, Greece, GREECE - and
does it matter?
>>>>>>>
>>>>>>> --
>>>>>>> Jo
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> "Michael Fesser"
<[email protected]> wrote in message
>>>>>>>
news:[email protected]...
>>>>>>>> .oO(josie1one)
>>>>>>>>
>>>>>>>>>Is it important to have a
country of origin?
>>>>>>>>
>>>>>>>> For what?
>>>>>>>>
>>>>>>>>>If so, do I just type
Greece?
>>>>>>>>>
>>>>>>>>><input type=hidden
value="GREECE" name=originating_country>
>>>>>>>>
>>>>>>>> It all depends on the
server-side script. This hidden field alone
>>>>>>>> in the
>>>>>>>> HTML means absolutely
nothing.
>>>>>>>>
>>>>>>>> Micha
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
> -
What is the diff b\w open form and start form in scripts.
Hi,
can any one tell me what is the diff andb\w open form and start form in scripts.when we should use open form and when start form.Hi Friend.
I have understood some usefull information and would like to share with you.
Within one transaction, you can open and close several layout sets using OPEN_FORM and
CLOSE_FORM, however not simultaneously. You can use parameters in the OPEN_FORM to control
whether the output is stored in the same print request. But also the SAP spool decides,
depending on several plausibility checks, whether new output is appended to an existing
print request or whether to create a new print request anyway.
CALL FUNCTION 'OPEN_FORM'
CALL FUNCTION 'CLOSE_FORM'
CALL FUNCTION 'OPEN_FORM'
CALL FUNCTION 'CLOSE_FORM'
You cannot combine ABAP/4 list output and SAPscript output in one print request.
START A LAYOUT SET AGAIN
Usually a print program does not print only one urging letter or one account statement, but
several layout sets for different customers. To have the output for each customer begin with
the start page of the layout set, you must start the current layout set again and again.
To start a layout set again, you must first end the current layout set and then open the
layout set again. Within one print request, first call the function module END_FORM. It
executes the final processing for the current layout set. Then start the layout set again
using START_FORM. Output then begins again on the start page of the desired layout set.
CALL FUNCTION 'OPEN_FORM'
CALL FUNCTION 'START_FORM'
CALL FUNCTION 'END_FORM'
CALL FUNCTION 'START_FORM'
CALL FUNCTION 'END_FORM'
CALL FUNCTION CLOSE_FORM
Hope your obstacle is cleared.
If not do ask me again?
Maybe you are looking for
-
Trying to find the location for getting started with hootbar
I added the hootbar addon and on the information page about the addon it said you could go to the getting started page to find information on how to use hootbar but I can't locate the page
-
Business Content extractors' "other fields" - How do I get them?
Hi everyone. I have installed <b>0CO_OM_OPA_6</b> from Business Content, however there are 6 fields that don't appear. If you right-click on 0CO_OM_OPA_6 in DataSource Overview (RSA1-->SourceSystems) and choose "Object Overview", a window pops up wit
-
I'm getting some very erratic behavior when employing the 'Adjust' settings: noise filling up the screen incrementally in rectangular patches. Here's a link to a screenshot: http://s1098.photobucket.com/albums/g367/swiftyj/ I'm wondering if the 'iPho
-
Hi all, my laptop is not working sense yesterday, its just showing the mac apple, i dont know why, but i need it so bad what should i do, should i press some bottoms or something ! Help plz Regards Nada Juma
-
I want to insert a picture in the header area of adobe forms central can you help me do this Thanks alisonm