1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

php database contact form?

Discussion in 'PHP' started by Johnburk, Jan 10, 2006.

  1. #1
    Do you know of a contact form where the information is emailed and also put in a mysql database?
     
    Johnburk, Jan 10, 2006 IP
  2. GeorgeB.

    GeorgeB. Notable Member

    Messages:
    5,695
    Likes Received:
    288
    Best Answers:
    0
    Trophy Points:
    280
    #2
    No but I can code one within an hour for $30

    PM me :)
     
    GeorgeB., Jan 10, 2006 IP
  3. danzor

    danzor Peon

    Messages:
    208
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #3
    create a html form, name the fields whatever you like, name, email, message etc.

    then save this as contact.php

    <?php
    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];

    $dbhost = 'localhost';
    $dbusername = 'database-username-here';
    $dbpasswd = 'database-password-here';
    $database_name = 'database-name-here';
    $connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd")
    or die ("Couldn't connect to server.");
    $db = mysql_select_db("$database_name", $connection)
    or die("Couldn't select database.");

    $query = mysql_query("INSERT INTO `contact` (name, email, message) VALUES ('$name', '$email', '$message')");

    if (!$query) { echo "there was an error sending the message. please try again."; }
    else { echo "your message was sent successfully."; }
    ?>

    worth paying $30 for? no.
     
    danzor, Jan 11, 2006 IP
    Johnburk likes this.
  4. onlyican.com

    onlyican.com Peon

    Messages:
    206
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Then under that, add the function to email
    do it wil add to the db and email
     
    onlyican.com, Jan 11, 2006 IP
  5. tobgay

    tobgay Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    man why do you charge so much for a few lines of code.. i dont think you ll progress if you dp business like this..
     
    tobgay, Sep 28, 2008 IP
  6. sastro

    sastro Well-Known Member

    Messages:
    214
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #6
    sastro, Sep 29, 2008 IP