Click to See Complete Forum and Search --> : PHP help for dummies


rebelxug
11-10-2005, 02:02 PM
Ok first off I don't even know the best way to go about this, but I am working on a gaming fan site and want to be able to have a review section that is stored in a database and produces a html page. All the data needs to be entered into form with several boxes to allow users to fill in with text. Any suggestions are will be a real help. I am also doing this all without the use of any portal software.

katasova
11-10-2005, 02:35 PM
hi there, before anything else happen i want to say my english is not very good but i want to hlp u hehe :D

I bet u already have Apache or IIS or any server installed in ur PC so u can test all u do in localhost. If u dont i suggest WAMP server if u use PC or MAMP if u use Mac. Just look for any of this in google, download it and install it...

Now if u have the forms rdy do something liek this:



<form action="nextPage.php" method="POST" name="something">
....
</form>


Now in the page named 'nextPage.php'

$name = $_POST["name"]; //$name is the name of ur variable where u store data from users.... $_POST["name"]; is the call to the value of the form (name) in the last page that u want to save

....

$user="root";
$pass="root";
$server="localhost";
$base="base";
$connect=mysql_connect($server,$user,$pass) or die ("Error."); //connect to sql

mysql_select_db($base ,$conect) or die("Error."); //select DB

//time to save ur data in DB

$query = "INSERT INTO table (NAME, Email.....) VALUES '$name', '$email', ....";


$res = mysql_query(query) or die ("Error");

// if u didnt got any error then teh data is saved in ur DB


Now just add some html code here to say ur user that u saved his data in the DB, thx for choose ur page, etc....

Hope this hlp u, if u want an easy example i made some time ago send me an email to katasova@gmail.com and il send u back the source code...