0
Welcome Guest! Login
0 items Join Now

PHP forms help

  • PHP forms help

    Posted 16 years 9 months ago
    • I've now put together a .php form but can not seem to getting it working in joomla, this is save as quote.php in the main folder on the server. please see code below:
      // first, check all "required" fields have values
      if (!$name || !$phone || !$email)
      //if (!$first_name)
      {

      header("Location:index.php?error=Please-fill-all-required-fields");
      }

      /*
      else if (!eregi('^([._a-z0-9-]+[._a-z0-9-]*)@(([a-z0-9-]+\.)*([a-z0-9-]+)(\.[a-z]{2,3})?)$', $email))
      {
      header("Location:contact.html?error=Please enter a valid e-mail address");
      }
      */

      else
      {
      $sent = date("d/m/Y G:i"); // timestamp the e-mail

      $to = "This email address is being protected from spambots. You need JavaScript enabled to view it.";

      $subject = "Online Enquiry";

      $details = stripslashes($details); // stripslashes() removes any "\"

      $headers .= "From: \"$name\"<$email>"; // when you receive the e-mail


      $msg = "CONTACT DETAILS\n\n";
      $msg .= "company: $company\n";
      $msg .= "phone: $phone\n";
      $msg .= "email: $email\n";
      $msg .= "title: $title\n";
      $msg .= "name: $name\n";
      $msg .= "url: $url\n";
      $msg .= "postcode: $postcode\n\n";
      $msg .= "city: $city\n\n";


      $msg .= "Sent on $sent\n";

      mail("$to","$subject","$msg","$headers"); // smtp email

      header("Location:thankyou.html"); // redirect the user to a "thank you"
      }

      ?>

      and on the contact page, which I did as an article I have put a form, please see below:

      <div class="formbox">
      <form action="send_quote.php" method="post" name="Free Quote" id="Free Quote">
      <fieldset>
      <label for="company">Company:</label>
      <input id="company" type="text" name="company" />
      <br />
      <label for="title">Title:</label>
      <select id="title" name="title">
      <option selected="selected">Mrs.</option>
      <option>Mr.</option>
      <option>Ms.</option>
      <option>Dr.</option>
      <option>Prof.</option>
      </select>
      <br />
      <label for="fname">Name: * </label>
      <input id="name" type="text" name="name" />
      <br />
      <label for="name">Website URL:</label>
      <input id="url" type="text" name="url" />
      <br />
      <label for="street">Phone Number: * </label>
      <input id="phone" type="text" name="phone" class="phone" />
      <br />
      <label for="street">Your E-mail: * </label>
      <input id="email" type="text" name="email" class="email" />
      <br />
      <label for="zip">Post Code / City:</label>
      <input id="postcode" type="text" name="postcode" maxlength="5" class="postcode">

      <input type="text" name="city" class="city" />
      <br />
      </fieldset>
      <div class="buttons">
      <input type="submit" name="submit" class="subddc" value="Submit" />

      <input type="reset" name="reset" value="Cancel" class="subddc" />
      </div>
      </form>

      I have also put the CSS into the template. BUT for the life of me I can not work out how to get it working?? I've tried it as static pages and all works fine. But when I go to the contact page and enter the info into the page it comes up with a 404 error??

      Any help would be greatly appreciated.

      Thanks Dan
    • Last Edit: 16 years 9 months ago by Daniel A Wright.
    • 's Avatar

    Re: PHP forms help

    Posted 16 years 8 months ago
    • Sorry can't identify your problem, but why not try Facile Forms or the other one Phil a Form.

      FF is pretty good once you get your head around how it works.

      I havn't used PaF.

Time to create page: 0.065 seconds