SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Member GerrySH's Avatar
    Join Date
    Dec 2013
    Location
    New Jersey, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Looking For a PHP Form Script

    Hello Everyone!
    <snip /> I'm looking for a PHP Form Script to go with the form I created. Can someone tell me where I can find a good PHP Form Script.

    Thanks for your kind help in advance.

    GerrySH
    Last edited by cpradio; Jan 4, 2014 at 13:01. Reason: Removed reference to website

  2. #2
    SitePoint Member Godz06's Avatar
    Join Date
    Nov 2013
    Posts
    12
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Can you elaborate? What kind of php form script? login? register? email?

    Something like this?

    Code:
    <form action="" method="post">
    <input type="text" name="username"><br />
    <input type="password" name="password"><br />
    <input type="submit" value="submit">
    </form>

  3. #3
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,398
    Mentioned
    81 Post(s)
    Tagged
    3 Thread(s)
    You need to supply more details if you want a useful reply.

    The website I used to use for this sort of thing was Hotscripts

  4. #4
    SitePoint Addict bronze trophy
    Join Date
    Apr 2013
    Location
    Ithaca
    Posts
    351
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    Well you can always use my GUI API, which provides easy ways to create HTML forms, tables and other components/containers in plain PHP. Heres the link, you will need basic OOP knowledge to use it properly though:
    http://www.phpclasses.org/package/78...ogrammers.html

  5. #5
    SitePoint Member GerrySH's Avatar
    Join Date
    Dec 2013
    Location
    New Jersey, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks For Your Reply Re:Looking For PHP Script

    Hi Godz06;5611945]
    Thanks for replying so quickly to my inquiry. I need a php script for the form below.
    GerrySH

    form action="http://www.mywebsite.com/" method="post">
    <input type="hidden" name="subject value="Form Submission" />
    <input type="hidden" name="redirect" value="thankyou.html" />

    <p>
    <label>First Namebr />

    <input name="first name" type="text" id="first name" size="30" maxlength="40" />
    </label>
    </p>
    <p>
    <label for="last name">Last Namebr />

    </label>

    <input name="last name" type="text" id="last name" size="30" maxlength="40" />
    </p>
    <p>
    <label for="email">E-Mail:
    <br />
    </label>
    <input name="email" type="text" id="email" size="30" maxlength="40" />
    </p>

    <p>

    <label>Type Your Comments Here:
    <br />
    <textarea name="comments" id="comments" cols="45" rows="10"></textarea>
    </label>
    </p>
    <p>
    <label>
    <input name="submit" type="submit" id="submit" accesskey="s" onclick="MM_validateForm('first name','','R','last name','','R','email','','RisEmail');return document.MM_returnValue" value="Submit" />
    </label>
    </p>



    </form>

    Quote Originally Posted by Godz06 View Post
    Can you elaborate? What kind of php form script? login? register? email?

    Something like this?

    Code:
    <form action="" method="post">
    <input type="text" name="username"><br />
    <input type="password" name="password"><br />
    <input type="submit" value="submit">
    </form>

  6. #6
    SitePoint Member GerrySH's Avatar
    Join Date
    Dec 2013
    Location
    New Jersey, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Rubble: I did supply the name of my website but it was edited out by an administrator. Thanks for your tip, I'll check out Hotscripts.


    Quote Originally Posted by Rubble View Post
    You need to supply more details if you want a useful reply.

    The website I used to use for this sort of thing was Hotscripts

  7. #7
    SitePoint Member GerrySH's Avatar
    Join Date
    Dec 2013
    Location
    New Jersey, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hall of Famer! Thanks for the link. Have a good day.
    GerrySH

    Quote Originally Posted by Hall of Famer View Post
    Well you can always use my GUI API, which provides easy ways to create HTML forms, tables and other components/containers in plain PHP. Heres the link, you will need basic OOP knowledge to use it properly though:
    http://www.phpclasses.org/package/78...ogrammers.html

  8. #8
    SitePoint Addict bronze trophy
    Join Date
    Apr 2013
    Location
    Ithaca
    Posts
    351
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by GerrySH View Post
    Hall of Famer! Thanks for the link. Have a good day.
    GerrySH
    You are very welcome. The script is very easy to use once you know how to program in OOP, its even better suited for a MVC framework in which the view is rendered in one place. If your form is simple, you may use the FormBuilder class to simplify the process of creating PHP forms.

  9. #9
    SitePoint Member GerrySH's Avatar
    Join Date
    Dec 2013
    Location
    New Jersey, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks Q

    Hall of Famer!

    I'm embarrassed to say that I have little knowledge of PHP and have no idea what to do with all the files in your GUI API. Am I supposed to download all the files? I don't have a windows computer but can I download the files to my mac computer? I'll follow your advice and use the FormBuilder class because I have a very basic form. See I paste the form below. Thanks again for all the info. GerrySH

    form action="http://www.mywebsite.com/" method="post">
    <input type="hidden" name="subject value="Form Submission" />
    <input type="hidden" name="redirect" value="thankyou.html" />

    <p>
    <label>First Namebr />

    <input name="first name" type="text" id="first name" size="30" maxlength="40" />
    </label>
    </p>
    <p>
    <label for="last name">Last Namebr />

    </label>

    <input name="last name" type="text" id="last name" size="30" maxlength="40" />
    </p>
    <p>
    <label for="email">E-Mail:
    <br />
    </label>
    <input name="email" type="text" id="email" size="30" maxlength="40" />
    </p>

    <p>

    <label>Type Your Comments Here:
    <br />
    <textarea name="comments" id="comments" cols="45" rows="10"></textarea>
    </label>
    </p>
    <p>
    <label>
    <input name="submit" type="submit" id="submit" accesskey="s" onclick="MM_validateForm('first name','','R','last name','','R','email','','RisEmail');return document.MM_returnValue" value="Submit" />
    </label>
    </p>



    </form>

    Quote Originally Posted by Hall of Famer View Post
    You are very welcome. The script is very easy to use once you know how to program in OOP, its even better suited for a MVC framework in which the view is rendered in one place. If your form is simple, you may use the FormBuilder class to simplify the process of creating PHP forms.

  10. #10
    SitePoint Addict bronze trophy
    Join Date
    Apr 2013
    Location
    Ithaca
    Posts
    351
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    Well I can easily translate your code above into the below PHP code using my GUI API:

    PHP Code:
    $form = new FormBuilder("myform""http://www.mywebsite.com""post");
    $form->buildPasswordField("hidden""subject""Form Submission"TRUE)
         ->
    buildPasswordField("hidden""redirect""thankyou.html"TRUE)
         ->
    buildComment("First Name: "TRUE)->buildTextField("firstname")  
         ->
    buildComment("Last Name: "TRUE)->buildTextField("lastname")
         ->
    buildComment("E-mail: "TRUE)->buildTextField("email")
         ->
    buildComment("Type your comment here: "TRUE)->buildTextArea("comments")
         ->
    buildButton("Submit""submit""submit"); 

  11. #11
    SitePoint Addict bronze trophy vectorialpx's Avatar
    Join Date
    Dec 2012
    Location
    Bucharest
    Posts
    247
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    You have to create your own actions.
    There is no generator that gets an "HTML" and returns "the PHP" code that makes some action.
    You have to define that action.

    So, you'd better start to code
    Also, you have some nasty HTML errors (I think you used some generator <my guess: Dreamweaver> and, you should type it by hand).
    1. Check your quotes
    2. Do not have id or name with spaces ("first name" is bad. Use "first_name")
    3. Align your code, it will be easier to debug.
    4. The submit does not need a label
    5. Avoid JavaScript validations. You may have AJAX, but this is another chapter.
    6. The FORM action may be empty. The form will send the request to the current PHP page.

    I have some time and I will write some code for you but, it's not tested.

    PHP Code:
    <?php

    error_reporting
    (E_ALL);

    $ERROR = array();

    if( isset(
    $_POST['submit']) ) {

        
    $requiredFields = array(
            
    'first_name' => 'First Name',
            
    'email' => 'E-Mail',
            
    'comments' => 'Your Comments',
        );
        foreach( 
    $requiredFields as $field => $label )  {
            if( 
    false == isset($_POST[$field]) || '' === trim($_POST[$field]) ) {
                
    $ERROR[] = 'The field '.$label.' is required.';
            }
        }

        if( 
    false == filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ) {
            
    $ERROR[] = 'You provided an invalid email address.';
        }
        
        if( empty(
    $ERROR) ) {
            
            
    // do whatever you need
            
    $to 'you@example.com';
            
    $subject 'website message';
            
            
    $message "First name: {$_POST['first_name']}<br /><br />\n
            Last name: 
    {$_POST['last_name']}<br /><br />\n
            Email: 
    {$_POST['email']}<br /><br />\n
            Comments: 
    {$_POST['comments']}<br /><br />\n
            IP: 
    {$_SERVER['REMOTE_ADDR']}<br /><br />\n
            Server date: "
    .date('d M Y H:i:s');
            
            
    $headers  'MIME-Version: 1.0' "\r\n";
            
    $headers .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";
            
    $headers .= 'From: ' $_POST['email'] . "\r\n";
            
            if( @
    mail($to$subject$message$headers) ) {
                
    header('Location: '.( isset($_POST['redirect']) ? $_POST['redirect'] : './' ));
                exit;
            } else {
                
    $ERROR[] = 'Cannot send the email.';
                
    // this will not work on localhost unless you have a mail-server installed
            
    }
        }
        
    }

    ?>
    <form action="" method="post">

        <?php if( !empty($ERROR) ) { ?>
            <p style="color:#c00"><?php echo '- '.implode('<br />- '$ERROR?></p>
        <?php ?>

        <input  type="hidden" name="subject" value="Form Submission" />
        <input type="hidden" name="redirect" value="thankyou.html" />

        <p>
            <label>First Name: *<br />
            <input name="first_name" type="text" id="first_name" size="30" maxlength="40" /></label>
        </p>
        <p>
            <label>Last Name:<br />
            <input name="last_name" type="text" id="last_name" size="30" maxlength="40" /></label>
        </p>
        <p>
            <label>E-Mail: *<br />
            <input name="email" type="text" id="email" size="30" maxlength="40" /></label>
        </p>

        <p>
            <label>Type Your Comments Here: *<br />
            <textarea name="comments" id="comments" cols="45" rows="10"></textarea></label>
        </p>
        <p>
            <input name="submit" type="submit" id="submit" accesskey="s" value="Submit" />
        </p>
    </form>
    PS: I once had an ajax contact form, when I had a blog. By time, I decided that I'm not a blogger so, I deleted the blog.
    If you are interested send me a PM with your email and I will give you the code (I will search into my archive, hope I'll find it).
    Be nice to nerds. Chances are you'll end up working for one - Bill Gates
    > photos | admin panel

  12. #12
    SitePoint Member GerrySH's Avatar
    Join Date
    Dec 2013
    Location
    New Jersey, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hall of Famer!
    That's amazing! Thanks for all your help.
    GerrySH

  13. #13
    SitePoint Member GerrySH's Avatar
    Join Date
    Dec 2013
    Location
    New Jersey, USA
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Vectorialpx! Thanks for your help. I'll PM you.


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
  •