SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Form, is it possible to line up two fields?

    Hi all,
    I would like to create a form page that I will be able to collect a lot of information from the user. But I would like the form to look something like this:

    Code:
    Model # [             ]              Serial # [                      ]
    Room # [             ]              Tracking # [                    ]
    Each [ ] is one field. I would like to have two fields lined up on one line instead of everything looks like this:
    Code:
    Model # [             ]              
    Serial # [                      ]
    Room # [             ]             
    Tracking # [                    ]
    When it gets submitted to email, I would also like it to be in the format where two fields are on one line. Is it possible? I have tried so many different free php form generators and even attempt to modify some.. but due to my lack of php knowledge, I keep failing :/ I need to get it done as soon as possible =|

    I like this php form gen very much, but I can't line them up: http://phpformgen.com

    I have also tried to modify the form from http://www.thesitewizard.com/wizards/feedbackform.shtml

    But both are hard for me Is there any form generator or easy to modify form scripts that I can use? Please help, thanks in advance.

  2. #2
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could use a table to align the form input fields something like this

    Code:
    <TABLE>
    <TR>
    	<TD>Model # [             ]</TD>
    	<TD>Serial # [                      ]</TD>
    </TR>
    <TR>
    	<TD>Room # [             ]</TD>             
    	<TD>Tracking # [                    ]</TD>
    </TR>
    </TABLE>
    To change the way the emails are formatted would need modification to the actual php script that processes the form. Probably not hard to do though. If you post the part of the script that prepares the email data should be able to show you what to change.
    |
    Add Your Robotics site to my Robot Directory: submit
    |
    Add Your Las Vegas Website to my Las Vegas Directory: submit

  3. #3
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ooh! It is working for the submission page =O! Thanks a lot. But hm.. I have a problem with the processing part

    Code:
    <?php
    
    $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
    
    mail("test@test.com","phpFormGenerator - Form submission","Form data:
    
    Name: " . $_POST['field_1'] . " 
    Email Address: " . $_POST['field_2'] . " 
    Comment: " . $_POST['field_3'] . " 
    
    
     powered by phpFormGenerator.
    ");
    
    include("confirm.html");
    
    ?>

    That is from processor.php I don't know how to format this part
    Thank you very much.

  4. #4
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Everything in this part is the body of your email and you can change the layout like you would a normal email body;

    Form data:

    Name: " . $_POST['field_1'] . "
    Email Address: " . $_POST['field_2'] . "
    Comment: " . $_POST['field_3'] . "


    powered by phpFormGenerator.



    so you could change it like this to put 2 fields on 1 line;

    Form data:

    Name: " . $_POST['field_1'] . " Email Address: " . $_POST['field_2'] . "
    Comment: " . $_POST['field_3'] . "


    powered by phpFormGenerator.


    and from your post I am assuming you have more than just the 3 fields you want emailled, so you might end up making it look something like this;

    Form data:

    Name: " . $_POST['field_1'] . "
    Email Address: " . $_POST['field_2'] . "
    Comment: " . $_POST['field_3'] . "

    Model: " . $_POST['field_4'] . " Serial: " . $_POST['field_5'] . "
    Room: " . $_POST['field_6'] . " Tracking: " . $_POST['field_7'] . "


    powered by phpFormGenerator.


    (you will need to use the right field numbers of course)

    each field code you use just needs to be enclosed in the double quotes like; " . $_POST['field_1'] . " but everything else is just plain text you can edit as you like.
    |
    Add Your Robotics site to my Robot Directory: submit
    |
    Add Your Las Vegas Website to my Las Vegas Directory: submit

  5. #5
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome! It totally works! One last question >_> (So sorry for bothering) Is it possible to use HTML code there? I tried to use HTML code, but it shows up as the code itself. I am trying to space them out evenly. Hitting "space bar" sort of works.. but I would love to have them in a table layout format if possible.

    Anyways, thank you very much You saved me a lot of headaches!

  6. #6
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can use html... but it isn't quite as straightforward.

    You will need to add an additional header field to tell it you are sending an html formatted message.

    This page of the php manual looks like it has several cut n paste examples people have posted that should get you there if you decide to try;

    http://au.php.net/manual/en/ref.mail.php


    this might help too, you will add the header fields to the mail command here;

    powered by phpFormGenerator.
    ", "HEADER");


    or maybe someone else with a bit more expertise then me will come past and give you the exact code ;-)
    |
    Add Your Robotics site to my Robot Directory: submit
    |
    Add Your Las Vegas Website to my Las Vegas Directory: submit

  7. #7
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got it now Thank you again.

  8. #8
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    a pleasure
    |
    Add Your Robotics site to my Robot Directory: submit
    |
    Add Your Las Vegas Website to my Las Vegas Directory: submit


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •