Results 1 to 2 of 2

Thread: MySql Connection

  1. #1
    Join Date
    Dec 2011

    MySql Connection

    Dear Sir,

    HTML file has following codes

        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Connection Checking</title>
        <h1>Connection Checker</h1>
        <fieldset style=width:300px;background-color:#E0FFFF>
        <legend sytle=font-size:12;>Click Connect</legend>
        <form name="form1" action="connect.php" method="post">
        <tr><td></td><td align="center"><input type="submit" name="button1" value="Connect">
    and Connect.php has folllowing codes

        // Connection variables
        // Connect to database
        $con=mysqli_connect("$host", "$username", "$password");
        // Connect result
        die('Error Connecting to Database: ' . mysqli_error());
        echo "Connected" . mysqli_error($con);
        //close the connection
    Both files have no problems and works fine.

    But I need following modifications:

    When connection is established then this line trigs from connect.php

    echo "Connected" . mysqli_error($con);

    While standing on html page, I want to show a messagebox like this


    In other words

    When I press Connect button then connection result must appear on same page not on other page.

    Please help
    Last edited by tqmd1; 11-09-2013 at 03:01 AM.

  2. #2
    Join Date
    Jul 2013
    Voorheesville NY USA
    What "other" page?

    Your html is going to call your "connect.php" script. That is going to run and display your message on a blank screen. That is all. Now to have that message displayed differently you have to put some html in your connect script to display your webpage and maybe make a <div with some border and coloring and a title bar in a div inside your div. Then display a php variable that you create instead of using 'echo' to send your message. Some CSS will come in handy to design your box.

    Or you could use javascript, but that is another forum.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center