- Category: HTML
- #765139HTML 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, asp.net etc.
Editor, DotNetSpider MVM
Microsoft MVP 2014 [ASP.NET/IIS]
- #765144Following 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#, VB.net 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.
Direction is important than speed
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
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.
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 : email@example.com
'Not by might nor by power, but by my Spirit,' says the LORD Almighty.