If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Junior Member
    Join Date
    May 2011
    Member #
    hi all i have a script that adds data to a database and display's it on my web site. it works as far as the adding data into the database and displaying it on my page but. if i refresh on the display page it makes blank data. i do not get it can some one help... here is my code.


    define('DB_NAME', 'Eclipse_media');
    define('DB_USER', 'root');
    define('DB_PASSWORD', 'Steph1989');
    define('DB_HOST', 'localhost');

    $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);

    if (!$link) {
    die('Could not connect: ' . mysql_error());

    $db_selected = mysql_select_db(DB_NAME, $link);

    if (!$db_selected) {
    die('Can\'t use ' . DB_NAME . ': ' . mysql_error());

    $value = $_POST['company_name'];
    $value2 = $_POST['contact_name'];
    $value3 = $_POST['address'];
    $value4 = $_POST['street_number'];
    $value5 = $_POST['postcode'];
    $value6 = $_POST['contact_number'];
    $value7 = $_POST['contact_email'];
    $value8 = $_POST['budget'];
    $value9 = $_POST['description'];

    $sql = "INSERT INTO 3dartactforms (company_name, contact_name, address, street_number, postcode, contact_number, contact_email, budget, description) VALUES ('$value', '$value2', '$value3', '$value4', '$value5', '$value6', '$value7', '$value8', '$value9')";

    if (!mysql_query($sql)) {
    die('Error: ' . mysql_error());



    <form action="demo.php" method="post" />
    <p>Company Name: <input type="text" name="company_name" /></p>
    <p>Contact Name: <input type="text" name="contact_name" /></p>
    <p>Address: <input type="text" name="address" /></p>
    <p>Street Number: <input type="text" name="street_number" /></p>
    <p>Postcode: <input type="text" name="postcode" /></p>
    <p>Contact Number: <input type="text" name="contact_number" /></p>
    <p>Contact Email: <input type="text" name="contact_email" /></p>
    <p>Budget: <input type="text" name="budget" /></p>
    <p>Description: <textarea rows="10" cols="40" name="description"></textarea></p>
    <input type="submit" value="Submit" />





    /*Open the connection to our database use the info from the config file.*/
    $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);

    $sql = "SELECT company_name, contact_name, address, street_number, postcode, contact_number, contact_email, budget, description FROM 3dartactforms";

    $results = mysql_query($sql);

    if (!$results) {
    die('Invalid query: ' . mysql_error());

    echo '<h3>3D art ACT</h3>';

    while($result = mysql_fetch_array( $results )){
    echo '<div style="border: 1px solid #e4e4e4; padding: 15px; margin-bottom: 10px;">';
    echo '<p>Company Name: ' . $result['company_name'] . '</p>';
    echo '<p>Contact Name: ' . $result['contact_name'] . '</p>';
    echo '<p>Address: ' . $result['address'] . '</p>';
    echo '<p>Street Number: ' . $result['street_number'] . '</p>';
    echo '<p>Postcode: ' . $result['postcode'] . '</p>';
    echo '<p>Contact Number: ' . $result['contact_number'] . '</p>';
    echo '<p>Contact Email: ' . $result['contact_email'] . '</p>';
    echo '<p>Budget: ' . $result['budget'] . '</p>';
    echo '<p>Description: ' . $result['description'] . '</p>';
    echo '</div>';



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 05:25 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: