How to create Database for a website.

cqruwan1200

Well-known member
  • Nov 20, 2008
    3,705
    44
    48
    Hi Friends. I want to place data entry form for my web site. And I want to get data to a database. Can Some one help me for this. Thanks.....
     

    seth7

    Member
    Dec 5, 2007
    158
    1
    0
    ලංකාවෙ
    menna code

    menna php code.

    contact.php

    Code:
    <form method="post" action="sendeail.php">
                 
                    <?php
    $ipi = getenv("REMOTE_ADDR");
    $httprefi = getenv ("HTTP_REFERER");
    $httpagenti = getenv ("HTTP_USER_AGENT");
    ?>
                    <input type="hidden" name="ip" value="<?php echo $ipi ?>" />
                    <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
                    <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
                    Your Name: <br />
      <input type="text" name="visitor" size="35" />
      <br />
                    Your Email:<br />
      <input type="text" name="visitormail" size="35" />
      <br />
      <br />
      <br />
                    Attention:<br />
      <select name="attn" size="1">
        <option value=" Contact ">Contact </option>
      </select>
      <br />
      <br />
                    Mail Message: <br />
      <textarea name="notes" rows="4" cols="40"></textarea>
      <br />
      <input name="submit" type="submit" value="Send Mail" />
      <br />
                  </form>

    sendeail.php

    Code:
    <form method="post" action="sendeail.php">
                    <?php
    
    $ip = $_POST['ip'];
    $httpref = $_POST['httpref'];
    $httpagent = $_POST['httpagent'];
    $visitor = $_POST['visitor'];
    $visitormail = $_POST['visitormail'];
    $notes = $_POST['notes'];
    $attn = $_POST['attn'];
    
    
    if (eregi('http:', $notes)) {
    die ("Do NOT try that! ! ");
    }
    if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
    {
    echo "<h2>Use Back - Enter valid e-mail</h2>\n";
    $badinput = "<h2>Feedback was NOT submitted</h2>\n";
    echo $badinput;
    die ("Go back! ! ");
    }
    
    if(empty($visitor) || empty($visitormail) || empty($notes )) {
    echo "<h2>Use Back - fill in all fields</h2>\n";
    die ("Use back! ! ");
    }
    
    $todayis = date("l, F j, Y, g:i a") ;
    
    $attn = $attn ;
    $subject = $attn;
    
    $notes = stripcslashes($notes);
    
    $message = " $todayis [EST] \n
    Attention: $attn \n
    Message: $notes \n
    From: $visitor ($visitormail)\n
    Additional Info : IP = $ip \n
    Browser Info: $httpagent \n
    Referral : $httpref \n
    ";
    
    $from = "From: $visitormail\r\n";
    
    
    mail("[B]YOUR EMAIL ADDRESS[/B]", $subject, $message, $from);
    
    ?>
                    <p align="center"> Date: <?php echo $todayis ?> <br />
                      Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> ) <br />
                      Attention: <?php echo $attn ?> <br />
                      Message:<br />
      <?php $notesout = str_replace("\r", "<br/>", $notes);
    echo $notesout; ?>
      <br />
      <?php echo $ip ?> <br />
      <br />
      <a href="[B]index.html[/B]"> Next Page </a></p>
                  </form>

    :)
     

    cqruwan1200

    Well-known member
  • Nov 20, 2008
    3,705
    44
    48
    seth7 said:
    menna php code.

    contact.php

    Code:
    <form method="post" action="sendeail.php">
     
                    <?php
    $ipi = getenv("REMOTE_ADDR");
    $httprefi = getenv ("HTTP_REFERER");
    $httpagenti = getenv ("HTTP_USER_AGENT");
    ?>
                    <input type="hidden" name="ip" value="<?php echo $ipi ?>" />
                    <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
                    <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
                    Your Name: <br />
      <input type="text" name="visitor" size="35" />
      <br />
                    Your Email:<br />
      <input type="text" name="visitormail" size="35" />
      <br />
      <br />
      <br />
                    Attention:<br />
      <select name="attn" size="1">
        <option value=" Contact ">Contact </option>
      </select>
      <br />
      <br />
                    Mail Message: <br />
      <textarea name="notes" rows="4" cols="40"></textarea>
      <br />
      <input name="submit" type="submit" value="Send Mail" />
      <br />
                  </form>

    sendeail.php

    Code:
    <form method="post" action="sendeail.php">
                    <?php
     
    $ip = $_POST['ip'];
    $httpref = $_POST['httpref'];
    $httpagent = $_POST['httpagent'];
    $visitor = $_POST['visitor'];
    $visitormail = $_POST['visitormail'];
    $notes = $_POST['notes'];
    $attn = $_POST['attn'];
     
     
    if (eregi('http:', $notes)) {
    die ("Do NOT try that! ! ");
    }
    if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
    {
    echo "<h2>Use Back - Enter valid e-mail</h2>\n";
    $badinput = "<h2>Feedback was NOT submitted</h2>\n";
    echo $badinput;
    die ("Go back! ! ");
    }
     
    if(empty($visitor) || empty($visitormail) || empty($notes )) {
    echo "<h2>Use Back - fill in all fields</h2>\n";
    die ("Use back! ! ");
    }
     
    $todayis = date("l, F j, Y, g:i a") ;
     
    $attn = $attn ;
    $subject = $attn;
     
    $notes = stripcslashes($notes);
     
    $message = " $todayis [EST] \n
    Attention: $attn \n
    Message: $notes \n
    From: $visitor ($visitormail)\n
    Additional Info : IP = $ip \n
    Browser Info: $httpagent \n
    Referral : $httpref \n
    ";
     
    $from = "From: $visitormail\r\n";
     
     
    mail("[B]YOUR EMAIL ADDRESS[/B]", $subject, $message, $from);
     
    ?>
                    <p align="center"> Date: <?php echo $todayis ?> <br />
                      Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> ) <br />
                      Attention: <?php echo $attn ?> <br />
                      Message:<br />
      <?php $notesout = str_replace("\r", "<br/>", $notes);
    echo $notesout; ?>
      <br />
      <?php echo $ip ?> <br />
      <br />
      <a href="[B]index.html[/B]"> Next Page </a></p>
                  </form>

    :)

    Thanks Lot. Machan