Need help with form set up!

11 replies
  • WEB DESIGN
  • |
Hi all

I have a bit of trouble to get my form working. I am building my site with Joomla and use FCKeditor to create articles. When I edit my form properties I have to choose a method - either get or post. Now the problem is I don't know where to specify the address to which the information must be sent, or will it be saved somewhere in a directory?

Do I need to add code, maybe a module or extension? Please help!

Regards
#form #set
  • Profile picture of the author Aronya
    Cruiser,
    The Action= tag in your form code tells the computer what to do with the info typed into the fields. That tag will point to a file. Some kind of script file that contains within it the instructions on where to send the info.
    {{ DiscussionBoard.errors[1006756].message }}
    • Profile picture of the author Cruiser
      Thanks, can you please help me to configure this? I don't know coding and just want the easiest way for this to work. Let's say I want to send the info to contacts-at-mysite-dot-com, how will the code look and where exactly must I put it. I have seen the CSS editor in FCKeditor and know I must put it there somewhere. I thought action meant the page to which the user is redirected after submition, or does this also have to be included in the code?
      {{ DiscussionBoard.errors[1006786].message }}
  • Profile picture of the author Aronya
    Everything has to be included in the code, or it just doesn't happen.

    Here's the basic concept:
    You have visitors to a website. On that site you have a form that asks for information from the visitor. Let's say you ask for name & email address. The visitor fills in those 2 fields & clicks Submit.

    When the Submit button is clicked, your form is instructed to call a file into action. That file can send the info from those 2 fields to an email address, write it to a text file, or it can send it to a database somewhere. It's up to you, but you have to have the script set up for the form to call. Then, the script does the work.

    I'm not a programmer, so I look for what's easy to implement. I've been happy with having the info sent to me via email, using a script called 'mailer.php'. Not sure anymore where I found it, except that it was written by a guy named Ryan on a forum I used to hang out on. Do a search for 'mailer.php' & you'll come up with a ton of options. Or post in the programming forum here, asking for a script to do what you want.

    Good luck.
    {{ DiscussionBoard.errors[1006867].message }}
    • Profile picture of the author Cruiser
      Thanks, I now understand a lot more! I'm sure I will be able to find the script somewhere! Thanks again!
      {{ DiscussionBoard.errors[1006938].message }}
      • Profile picture of the author scriptnique
        I might be able to help you out with this. Can you post the code used to generate your form?
        {{ DiscussionBoard.errors[1007156].message }}
        • Profile picture of the author Cruiser
          That would be great!! Here is it...

          <p style="text-align: center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;</p>
          <form action="*don't know*" method="post" name="Form">
          <p>&nbsp;</p>
          <p style="text-align: center"><input name="Name" type="text" /></p>
          <p style="text-align: center"><input name="E-mail" type="text" /></p>
          <p style="text-align: center">&nbsp;</p>
          <p style="text-align: center"><input type="submit" name="Submit Button" value="Send" /></p>
          </form>
          <p>&nbsp;</p>

          I don't know if my method should be get or post. I would like to have the info sent to me in an e-mail as well as stored in a text file. Where will this text file be stored?

          I have an additional question and I think you might help. If I have a pdf file to download, say like an information document, how must the link look like? I am using Joomla and I think I need to save the pdf in a folder in the media manager, and then create a link to it somehow?

          Thank you very much for your time and effort!!

          Regards
          {{ DiscussionBoard.errors[1008794].message }}
          • Profile picture of the author Cruiser
            I soved the problem to create a link to download a pdf document, was really easy! Now it's just my form I must get right!
            {{ DiscussionBoard.errors[1008995].message }}
  • Profile picture of the author scriptnique
    Hey there. I put together some code for sending the email and listed it below. You'll want to change the value for the variable youremail to the email address you want the info sent to. You can change the subject as well. I commented those variables inside Begin value changes. You'll want to replace the entire form with the code below.

    PHP Code:
    <?php
    if (strlen($_POST["Name"]) > 0)
    {
    // Begin value changes
    $youremail "YOUREMAILADDRESSHERE@YOURADDRESS.COM";
    $subject "Your Subject For Email";
    // End value changes

    $status TRUE;
    $regexp "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";
    if (!
    eregi($regexp$_POST["Email"]))
    {
    $status FALSE;
    $message .= "<p>Email Address is invalid. Please enter another email address.</p>";
    }
    if (!
    preg_match('/^[a-zA-Z0-9 _]{1,140}$/',$_POST["Name"]))
    {
    $status FALSE;
    $message .= "<p>Name entered is invalid. Please enter another Name.</p>";
    }
    if(
    $status != FALSE)
    {
    $headers "From: " $_POST["Email"] . "\r\n";
    $headers .= "X-Identification: ECS-Mk1-B\r\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
    $headers .= "Content-Transfer-Encoding: 7bit\n\n";
    $sendemail mail($youremail$subject"Name: " $_POST["Name"] . "\n" "Email Address: " $_POST["Email"] . "\n\n"$headers);
    $message .= "<p>Message has been sent.</p>";
    }
    echo 
    $message;
    }
    ?>
    HTML Code:
    <p style="text-align: center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
    <form action="*don't know*" method="post" name="Form">
    <p>&nbsp;</p>
    <p style="text-align: center"><input name="Name" type="text" /></p>
    <p style="text-align: center"><input name="Email" type="text" /></p>
    <p style="text-align: center">&nbsp;</p>
    <p style="text-align: center"><input type="submit" name="Submit Button" value="Send" /></p>
    </form>
    <p>&nbsp;</p>
    Now mind you, i've only had one cup of coffee this morning so if there are any errors please let me know.
    {{ DiscussionBoard.errors[1009722].message }}
    • Profile picture of the author scriptnique
      Sorry forgot the form action. You'll want the form action to be:

      <form action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post" name="Form">
      {{ DiscussionBoard.errors[1009739].message }}
  • Profile picture of the author LADWebDesign
    I use the RS Form extension for Joomla - makes it very easy to set up a form, and great support. Joomla! Form (not an affiliate link)
    {{ DiscussionBoard.errors[1010196].message }}
    • Profile picture of the author newbyr
      I agree with LADWebDesign. This component is relatively cheap, and does the job very well.

      Originally Posted by LADWebDesign View Post

      I use the RS Form extension for Joomla - makes it very easy to set up a form, and great support. Joomla! Form (not an affiliate link)
      {{ DiscussionBoard.errors[1010475].message }}

Trending Topics