You must Sign In to post a response.
  • Category: HTML

    How to connect an html page to an sql database

    Sir i have a html form and i want to submit my data in the sql so how can i code to it for that.
  • #765139
    HTML file is unable to connect to database you need to take support of scripting or code behind code. HTML are markup languages, basically they are running on client side, Now, Connecting to a database, happens on whole another level. It happens on server, which is where the website is hosted.
    So, in order to connect to the database and perform various data related actions, you have to use server-side scripts, like php, jsp, etc.

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #765144
    Following are some the tips to understand your requirement.

    1. HTML is used for design the page. you can crate only static pages.
    2. We have two kind scrips to handle our requirements. Client side script and Server side scripts.
    For ex, Client side scripts are used for handle the validation in the client side.
    Server side scripts will handle your request.

    I hope you are using any of the server side languages(C#, etc). You have to handle it.

    One more think you can do. You can use the JQuery AJAX call. You can send the data as JSON format.

    In this case you have to write restful web service and deploy in the server.

    By Nathan
    Direction is important than speed

  • #765720

    In html form you have an attribute called action where you can give your server url,
    like : <code> form action="action_page.asp" </code>
    So in form you need to create button which type is submit
    like : <code> input type="submit" value="Submit" </code>

    then value in forms will post to the server url you have mentioned

  • #766250

    It's not possible to connect sql database or submitting data to sql database from the html page directly.For connecting sql database or submitting data to sql database you need to use server side scripting such as php, asp, jsp, etc.


  • #766279

    ofcourse we canot connect db From Html. Because Html we can do only client side design so we canot do.
    you can do one thing try this code.

    <form id="form1" runat="server" action='Test.aspx'/>

    Name : Dotnet Developer-2015
    Email Id :

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • Sign In to post your comments