| | |
Input data into the table from HTML file
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2009
Posts: 3
Reputation:
Solved Threads: 0
Azul(Hi)
i created program on php where i can output data set of any table by submitting query.
i need help to input i mean to load data into the table from the HTML file
can any one give help please
thank you.
this is the program i created, so far it work just for retrevie the information only i am looking to add from HTML
there 6 tables: clients, departments, projects, jobs, manages employees
i created program on php where i can output data set of any table by submitting query.
i need help to input i mean to load data into the table from the HTML file
can any one give help please
thank you.
this is the program i created, so far it work just for retrevie the information only i am looking to add from HTML
there 6 tables: clients, departments, projects, jobs, manages employees
php Syntax (Toggle Plain Text)
<?php if (isset($_POST['door']) ) { $door=$_POST['door']; if(($door=="clients")||($door=="Clients")||($door=="departments")||($door=="Departements")||($door=="employees")||($door=="Employees")||($door=="jobs")||($door=="Jobs")||($door=="manages")||($door=="Manages")||($door=="projects")||($door=="Projects")) { if(($door =="clients")||($door =="Clients")) { echo"you requested table Clients"; echo"we will try connect to the db<br/>\n"; $barak=mysql_connect("127.0.0.1","root","agouni2008"); if (!$barak) { die("Fatal Error<br>".mysql_errno()."<br/>".mysql_error() ); }; echo "you are connect successfully to MYSQL <br/><br/>"; mysql_query("use dodgy"); if(mysql_errno() != 0) { die("can't change databse"); }; echo "Dtabase changed successfully! <br/>\n" ; $table = mysql_query("SELECT * FROM clients"); echo "<table border='10'>\n"; echo" <tr> <tr bgcolor='red'> <th>code</th> <th>name</th> <th>adress</th> <th>telephone</th> <tr>"; while($info=mysql_fetch_array($table,MYSQL_ASSOC)) { echo "<tr> <tr bgcolor='yellow'> <td bgcolor='blue'><b>".$info['Clie_ID']."<b/></td>". "<td>".$info['Clie_name']."</td>". "<td>".$info['Clie_adress']."</td>". "<td><a href='mailto:{$info['Clie_phone']}'>".$info['Clie_phone']."</a></td> </tr>\n"; }; echo "</table>\n"; //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ }//closing if of clienttable else//not clients { //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@testing if it is DEPARTMENTS@@@@@@@@@@@@@@@@ if(($door =="departments")||($door =="Dpartments")) { echo"you requested table Departments "; echo"we will try connect to the db<br/>\n"; $barak=mysql_connect("127.0.0.1","root","agouni2008"); if (!$barak) { die("Fatal Error<br>".mysql_errno()."<br/>".mysql_error() ); }; echo "you are connect successfully to MYSQL <br/><br/>"; mysql_query("use dodgy"); if(mysql_errno() != 0) { die("can't change databse"); }; echo "Dtabase changed successfully! <br/>\n" ; $table = mysql_query("SELECT * FROM departments"); echo "<table border='10'>\n"; echo" <tr> <tr bgcolor='red'> <th>code</th> <th>name</th> <th>adress</th> <tr>"; while($info=mysql_fetch_array($table,MYSQL_ASSOC)) { echo "<tr> <tr bgcolor='yellow'> <td bgcolor='blue'><b>".$info['Dep_cod']."<b/></td>". "<td>".$info['Dep_name']."</td>". "<td>".$info['Dep_adress']."</td> </tr>\n"; }; echo "</table>\n"; }//closing if of departments //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@testing if it is employes@@@@@@@@@@@@@@@@@@@@@ if(($door =="employees")||($door =="Employees")) { echo"you requested table Employees "; echo"we will try connect to the db<br/>\n"; $barak=mysql_connect("127.0.0.1","root","agouni2008"); if (!$barak) { die("Fatal Error<br>".mysql_errno()."<br/>".mysql_error() ); }; echo "you are connect successfully to MYSQL <br/><br/>"; mysql_query("use dodgy"); if(mysql_errno() != 0) { die("can't change databse"); }; echo "Dtabase changed successfully! <br/>\n" ; $table = mysql_query("SELECT * FROM employees"); echo "<table border='10'>\n"; echo" <tr> <tr bgcolor='red'> <th>Id</th> <th>name</th> <th>DOB</th> <th>Address</th> <th>Department code</th> <tr>"; while($info=mysql_fetch_array($table,MYSQL_ASSOC)) { echo "<tr> <tr bgcolor='yellow'> <td bgcolor='blue'><b>".$info['Emp_id']."<b/></td>". "<td>".$info['Emp_name']."</td>". "<td>".$info['Emp_dob']."</td>". "<td>".$info['Emp_adress']."</td>". "<td>".$info['Dep_cod']."</td> </tr>\n"; }; echo "</table>\n"; }//closing if of empolyees //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@testing if it is jobs@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ if(($door =="jobs")||($door =="Jobs")) { echo"you requested table Jobs "; echo"we will try connect to the db<br/>\n"; $barak=mysql_connect("127.0.0.1","root","agouni2008"); if (!$barak) { die("Fatal Error<br>".mysql_errno()."<br/>".mysql_error() ); }; echo "you are connect successfully to MYSQL <br/><br/>"; mysql_query("use dodgy"); if(mysql_errno() != 0) { die("can't change databse"); }; echo "Dtabase changed successfully! <br/>\n" ; $table = mysql_query("SELECT * FROM jobs"); echo "<table border='10'>\n"; echo" <tr> <tr bgcolor='red'> <th>Employees Id</th> <th>Projects number</th> <th>Working Dtae</th> <tr>"; while($info=mysql_fetch_array($table,MYSQL_ASSOC)) { echo "<tr> <tr bgcolor='yellow'> <td bgcolor='blue'><b>".$info['Emp_id']."<b/></td>". "<td>".$info['Proj_num']."</td>". "<td>".$info['Date_work']."</td> </tr>\n"; }; echo "</table>\n"; }//closing if of jobs //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ testing if it is table manages@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ if(($door =="manages")||($door =="Manages")) { echo"you requested table Manages "; echo"we will try connect to the db<br/>\n"; $barak=mysql_connect("127.0.0.1","root","agouni2008"); if (!$barak) { die("Fatal Error<br>".mysql_errno()."<br/>".mysql_error() ); }; echo "you are connect successfully to MYSQL <br/><br/>"; mysql_query("use dodgy"); if(mysql_errno() != 0) { die("can't change databse"); }; echo "Dtabase changed successfully! <br/>\n" ; $table = mysql_query("SELECT * FROM manages"); echo "<table border='10'>\n"; echo" <tr> <tr bgcolor='red'> <th>Departments code</th> <th>Projects number</th> <tr>"; while($info=mysql_fetch_array($table,MYSQL_ASSOC)) { echo "<tr> <tr bgcolor='yellow'> <td bgcolor='blue'><b>".$info['Dep_cod']."<b/></td>". "<td>".$info['Proj_num']."</td> </tr>\n"; }; echo "</table>\n"; }//closing if of manages //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@testing if it is table projects@@@@@@@@@@@@@@@@@@@@@@@@@@@@ if(($door =="projects")||($door =="Projectss")) { echo"you requested table Projectss "; echo"we will try connect to the db<br/>\n"; $barak=mysql_connect("127.0.0.1","root","agouni2008"); if (!$barak) { die("Fatal Error<br>".mysql_errno()."<br/>".mysql_error() ); }; echo "you are connect successfully to MYSQL <br/><br/>"; mysql_query("use dodgy"); if(mysql_errno() != 0) { die("can't change databse"); }; echo "Dtabase changed successfully! <br/>\n" ; $table = mysql_query("SELECT * FROM projects"); echo "<table border='10'>\n"; echo" <tr> <tr bgcolor='red'> <th>Projects number</th> <th>Type</th> <th>Address</th> <th>Client Id</th> <tr>"; while($info=mysql_fetch_array($table,MYSQL_ASSOC)) { echo "<tr> <tr bgcolor='yellow'> <td bgcolor='blue'><b>".$info['Proj_num']."<b/></td>". "<td>".$info['Proj_type']."</td>". "<td>".$info['Proj_adress']."</td>". "<td>".$info['Clie_id']."</td> </tr>\n"; }; echo "</table>\n"; }//closing if of projects //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ENd of testinf and viewinf tables@@@@@@@@@@@@ }//closing else not cloients }//close testing tables of database else { echo "There is not any table called <b>".$door."</b> in the Dodgy database"; } echo "<tr> <A HREF='http://localhost/databases.php'>Click Here To go back the submit Query</A> </tr>"; }//close _POST else//of if _POST { echo "<html> <head><title>Viewing tables of database</title> </head> <body> <form action='' method='POST'> <input type='text' name='door'> <input type='submit' /> </form> </body> </html>"; }; ?>
Last edited by peter_budo; May 5th, 2009 at 2:20 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Apr 2009
Posts: 3
Reputation:
Solved Threads: 0
from DATA base (DB).
for more details: i have MYSQL and PHP instaed in machine only there no connect to any network (localhost).
as you see the program i posted before. from the html i put query then the program output table (data set) on html page. what i am looking how to use query to input from html file.
example: if have to unpdata table Clients i want to creat HTML page and by feeling all field (name, dob, address) and after pressing submit query will input this information on the table client.
thank you
for more details: i have MYSQL and PHP instaed in machine only there no connect to any network (localhost).
as you see the program i posted before. from the html i put query then the program output table (data set) on html page. what i am looking how to use query to input from html file.
example: if have to unpdata table Clients i want to creat HTML page and by feeling all field (name, dob, address) and after pressing submit query will input this information on the table client.
thank you
•
•
Join Date: Apr 2005
Posts: 149
Reputation:
Solved Threads: 0
•
•
•
•
from DATA base (DB).
for more details: i have MYSQL and PHP instaed in machine only there no connect to any network (localhost).
as you see the program i posted before. from the html i put query then the program output table (data set) on html page. what i am looking how to use query to input from html file.
example: if have to unpdata table Clients i want to creat HTML page and by feeling all field (name, dob, address) and after pressing submit query will input this information on the table client.
thank you
html Syntax (Toggle Plain Text)
<!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Add new Client</title> </head> <body> <form method="post" action="insertClient.php"> <table align="center" width="80%"> <tr> <td><input type="text" name="name" /></td> </tr> <tr> <td><input type="text" name="add" /></td> </tr> </table> </form> </body> </html>
and code for createClient.php is as follows:
php Syntax (Toggle Plain Text)
<? // write here db connectivity code /* value posted by user at html page. It will be retrived by post method and should be saved in php variables */ $name = $_POST["name"]; $add = $_POST["add"]; /* applying insert query. here the "name" and "add" are the name of db fields from client table and "$name", "$add" contains values posted by user */ $Q = mysql_query("Insert into clients (name, add) values ('$name', '$add') "); /* if you have setted the client id at auto increment then there is no need to insert the value for client id, as db will automatically insert new id when a new client will be added */ ?>
Hope that it will be helpful.
![]() |
Similar Threads
- how to retrive image file from mysql databse using php (PHP)
- Retrieve data from table (MySQL)
- Create HTML file from Dynamic JSP (JSP)
- File upload (PHP)
- How to Upload Image,file (PHP)
- Please help file name and folder name it doesn't array A-Z,0-9 (PHP)
- Conditional if statement for <input type="file"> (PHP)
- Uploading multiple Images through input type="file" (PHP)
- Temp Program (Visual Basic 4 / 5 / 6)
Other Threads in the MySQL Forum
- Previous Thread: sql server 2000 and mysql
- Next Thread: Bonus System DB design
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm database design developer development distinct drupal dui ec2 email enterprise eudora facebook form foss gartner gnu government gpl greenit groklaw groupware hiring hyperic images innerjoins ip joebrockmeier join journalism keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource penelope php priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql syntax techsupport thunderbird transparency virtualization





