Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Forms in DW rosponsive

Community Beginner ,
May 28, 2017 May 28, 2017

Looking for a nice way to create forms in DW possibly with j query.

Need a starting point.

Been looking around for a while, this has left me confused.

all help appreciated.

bob

1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 28, 2017 May 28, 2017

You need to tell us more. What kind of form? What does it do? Does it update a database or send an email?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 29, 2017 May 29, 2017

Hi

To start with just a simple contact form that is secure.

Bob

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 29, 2017 May 29, 2017

To start with just a simple contact form that is secure.

Do you want the contact form to email or post to a database? Here is a script that emails the response. Take everything that follows and paste it into a blank file. Follow the given instructions. This script must be run on a remote server that contains a mail server. It will not run on your local computer.

<?php
// Name this file contact.php
// Be sure to change the value of $to to your own email address
// Be sure to name the file contact.php
// the next line only runs the processing script if the form has been submitted.
// the next line makes sure the email address is actually an email address
// The "!" at the beginning means do the following if the email address is NOT true. Remove the "!" and it would mean IF IS TRUE
if (!filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL)){
$message="Please provide a correct email address";} else {
// strip_tags is a PHP function that removes all tags from a block of text. For instance harmful script could be injected in the form fields by a hacker. strip_tags will remove such scripts.
  $name = strip_tags($_POST['name']);
  $company_name = strip_tags($_POST['company_name']);
  $telephone = strip_tags($_POST['telephone']);
  $email = $_POST['email'];
  $comments = strip_tags($_POST['comments']);
  $to = 'your@emailaddress.com';
  $subject = 'Contact form submitted.';
  $body = $name. "\n" .$comments;
  $headers = 'From: ' .$email;
  // This is the line that actually mails the form data. The PHP function is simply mail(). The function needs to know:
  // who to send to
  // what the subject line should be
  //  what the email should consist of
  //  headers can include various info, but in this case just includes the email address of the sender
  // Note that if the email does not send, a message is returned to notify the user of the failure.
  if (mail($to, $subject, $body, $headers)) {
  echo 'Thanks for contacting us. We\'ll be in touch soon!';
  } else {
  $message = 'Sorry an error occurred. Please try again later.';
  }
  }
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<?php echo "<p style='color:red'>$message</p>"; ?>
<div class="contact_form">
    <form id="contactform" action="contact.php" method="post">
<p>Name:<br/><input name="name" type="text" required /></p>
<p>Company Name: <br/><input name="company_name" type="text" required/></p>
<p>Telephone: <br/><input name="telephone" type="tel" required/></p>
<p>Email: <br/><input name="email" type="email" required/></p>
<p>Comments: <br/><textarea name="comments" required/>   </textarea></p>
    <input type="submit" name="submit" value="Send!"/>

</form>
</div>
</body>
</html>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 29, 2017 May 29, 2017

Thank you

I will give it a try today.

Will let you khow how it goes

Thanks

Bob

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 29, 2017 May 29, 2017

Inbox > Message Detail

Subject:
Contact form submitted.
From:
bob@roatan.ws(Remove Preferred Sender)
Date:Mon, May 29, 2017 1:04 pm
To:roatan@roatan.ws

Bob Millsaps
Test 2

I recieved the above reply which is great but did not get any comments.
Suggestion pleas.
Thanks for you help
Bob
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 29, 2017 May 29, 2017
LATEST

Sorry the above was wrong The "Test2" was the comment.

Thank you very much.

b ob

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 28, 2017 May 28, 2017

jQuery or JavaScript is a client-side programming language.  To process form data, you must use server-side programming.

If  you need a basic contact form and your server supports PHP code, see this 3-part tutorial.

Alt-Web Design & Publishing: Responsive Contact Form with Bootstrap 3.2 and PHP (Part 1)

Nancy

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines