Jump to content

Inserting mysql table into html document


thenthornthing

Recommended Posts

Hi,

Right I'm not good with PHP so bear with me here...

I basically have a portal powered by PHP that is fine and doesn't really involve my question...

What I have is a mysql table which i need to insert a form into one of the pages of my portal so that my admins can fill it out, and then on another page the results of the table to be displayed, maybe formatted aswell...

 

The pages can be either html or php, i have no idea whether they need to be a certain one. :s

 

Cheers for your help in advance ;)

You need direct the form action of your html form to a php page eg formprocess.php then in formprocess.php use code similer to the following where 'textboxone' and 'textboxtwo' are the name="" sections of your html form elements.

 

$tbox1=mysql_real_escape_string($_POST['textboxone']);
$tbox2=mysql_real_escape_string($_POST['textboxtwo']);

$sql="INSERT INTO tablename (column1,column2) VALUES ('$tbox1','$tbox2')"; 

mysql_query($sql);

 

to print them out on a new page you need to use a SELECT * FROM tablename statement and echo the results this must be done with php

 

matt

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.