PHP forms

They have: 14 posts

Joined: Aug 2009

Im not a PHP programming expert and when designing sites id like to be able to include a proper php contact form - just a basic one with Name, Email and then message field

Im ok with the HTML form elements but its the php posting elements using the config.php that im not sure about. Can i get some simple generic php code that i can use to do this? Ive seen some but wondered if anyone knows if any that they could recommend?

He has: 629 posts

Joined: May 2007

I've had a lot of success with Wufoo. You can host the form on your own site, but the form processing is done on a secure server that will protect you from attacks. You get up to three forms for free, unless your site is a commercial one (sells something).

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

Wufoo is pretty impressive, they had put a lot into making their service excellent.

I'm trying to find the sample I posted on a thread somewhere on here, not luck yet, I'll try to post one later on when I get off work.

-Greg

They have: 14 posts

Joined: Aug 2009

Wufoo sounds good.
Incidentally i used Awebber and then complained to them about the masses of spam i received and contunie to receive as soon as i used it. I assume this is because of email/form scraping? I contacted Awebber and they didnt seem at all interested or didnt think that their forms generated spam. Im assuming their scripts dont have any kind anti scraping code built in hence the masses of email spam i keep getting. Or maybe its somethign i did wrong - anyay ive taken down my awebber forms and cancelled my subscription.

hhunt's picture

They have: 17 posts

Joined: Oct 2009

When working with forms, there are things you should consider. Are you sending the form content as email or sending it to a database somewhere? Whatever you are planning to achieve with your forms, it is important that you put security at the top of your priorities.

That said, there's a lot of PHP forms out there on the internet, so do a quick Google search and it will pull up a countless examples. Again, most of those tutorials will not address security but the focus will most certainly be on form in general.

Good luck

He has: 53 posts

Joined: Jun 2010

Hi, here mention a simple php script for you...

index_dir.php

<?php
if(isset($_POST['posted']))
                {
                  
$name=$_POST['dir_username'];
                  
$pass=$_POST['dir_password'];
                  
$connect=mysql_connect('localhost','root','');
               
$db=mysql_select_db('dir_db',$connect);
               
$query=mysql_query('SELECT * FROM dir_login',$connect);
                while(
$row=mysql_fetch_array($query))
                {
                   
$column1=$row['username'];
                   
$column2=$row['password'];
                    if(
$column1 == $name && $column2 == $pass)
                    {
                       
header('location:registration_dir.php');
                    }
                    else
                    {
                        echo(
'Sorry Username and password is mismatch');
                        exit();
                    }
                }
                }
            
?>

<form name="index_dir" method="post" action="index_dir.php">
<table align="center" border="">
        <tr>
               <td>
                 <b  style="background-color:#063">USERNAME</b>
                <input type="text" name="dir_username" value="USERNAME" style="background-color:#966">
                </td>
        </tr>
        <tr>
               <td><b style="background-color:#063">PASSWORD</b> 
               <input type="password" name="dir_password" value="*****" style="background-color:#966">
               </td>
        </tr>
        <tr>
               <td><input type="hidden" name="posted" value="true>"></td>
               <td>
               <input type="submit" name="dir_submir" value="GO" style="background-color:#063">
               </td>
       </tr>
</table>
</form>

Just go through it, and still if you prob then just mention here.

Bluejet's picture

They have: 12 posts

Joined: Jul 2010

You can use pform

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.