Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have an html form that accepts user info(Name, Contact Number) I need to store them into the sql server table.

How can I store them? There is no code behind,no asp page, nothing. Just an html page and an sql server.

this is the HTML form.

I would like to know whether php instead of html is useful for this or not.

HTML
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="insert_ac.html">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td colspan="3">Insert Data Into mySQL Database </td>
</tr>
<tr>
<td width="71">Name</td>
<td width="6">:</td>
<td width="301"><input name="name" type="text" id="name"></td>
</tr>
<tr>
<td>Lastname</td>
<td>:</td>
<td><input name="lastname" type="text" id="lastname"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="email" type="text" id="email"></td>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
Posted

1 solution

There is no either/or here: to do what you want, you must use both HTML and PHP.

The primary function of HTML is to structure a document and describe how it will be displayed. A secondary function is to allow the user to input data, which HTML will deliver back to the server. It cannot actually do anything with the data.

Storing, retrieving or otherwise manipulating data requires a programming language of some kind. The choice of language is depends on whether you want to do your processing in the browser (which is typically done with JavaScript) or on a remote server (where you can use PHP, ASP, C#, VB or some other language.) To provide feedback, however, you must be able to generate an HTML document which is delivered to and displayed by the user's browser.
 
Share this answer
 
Comments
Member 9380535 27-Nov-12 10:27am    
I used this html/php pages.
(insert.php)
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="insert_ac.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td colspan="3">Insert Data Into mySQL Database </td>
</tr>
<tr>
<td width="71">Name</td>
<td width="6">:</td>
<td width="301"><input name="name" type="text" id="name"></td>
</tr>
<tr>
<td>Lastname</td>
<td>:</td>
<td><input name="lastname" type="text" id="lastname"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="email" type="text" id="email"></td>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>

and (insert_ac.php) ....


";
echo "Back to main page";
}
else {
echo "ERROR";
}
?>




Gives some error.( can't store data into sql)
Member 9380535 27-Nov-12 10:28am    
(insert_ac.php)

";
echo "Back to main page";
}
else {
echo "ERROR";
}
?>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900