prcollin Posted July 16, 2007 Share Posted July 16, 2007 Is it easy to create an HTML form that connects to a database through a data handling form. I have php 4.4 on my server and wrote all my scripts in 5.0 language and they dont run so i just wanna use an HTML form to submit to a database and to retrieve info from it. Any help would be appreciated Link to comment https://forums.phpfreaks.com/topic/60190-html-form-to-database/ Share on other sites More sharing options...
tapos Posted July 16, 2007 Share Posted July 16, 2007 use www.google.com -- Tapos Pal Link to comment https://forums.phpfreaks.com/topic/60190-html-form-to-database/#findComment-299426 Share on other sites More sharing options...
arsl1006 Posted July 16, 2007 Share Posted July 16, 2007 Im new to this too (so please ignore this if im teaching you how to 'suck eggs'), but i think i can help: I'm working with PHP and MySQL and have <?PHP mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("database name") or die(mysql_error()); echo "<p>Successful connection to database</p>"; $strString = "INSERT INTO tablename(`fieldname`, `fieldname`) VALUES (`$value1box`,`$value2box`)"; $result = mysql_query($strString) or die(mysql_error()); echo "Results stored in database:"; $strQuery2="SELECT `fieldname1` , `fieldname2` FROM `tablename`"; $result = mysql_query($strQuery2) or die(mysql_error()); echo "<table border='2'>"; echo "<tr><th>fieldname1</th><th>fieldname2</th></tr>"; while($row = mysql_fetch_array( $result )) { echo "<tr><td>"; echo $row['fieldname1']; echo "</td><td>"; echo $row['fieldname2']; echo "</td></tr>"; } echo "</table></body></html>"; ?> <HTML><BODY> <form action="<?php $_PHP_SELF ?>" method="POST"> <input type="text" name="value1box" value="ENTER VALUE 1"> <input type="text" name="value2box" value="ENTER VALUE 2"> </form></body></html> .... I think ) Link to comment https://forums.phpfreaks.com/topic/60190-html-form-to-database/#findComment-299447 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.