Page 1 of 1
playersearch.php script
Posted: Wed Apr 16, 2003 8:52 am
by Lady Kverem
Quick question for anyone out there...
I presently run a php-nuke based website,
http://www.impossible-realities.net
I am looking to have a search area where people can submit their names and gaming information on what types of games they play.. (such as specific RPG games, Tabletop war games...etc) I was curious to know if there was anyone who had a script of the sort??
There is one on rpgregistry.com that's pretty sweet.
I'm not very good at programming or I'd do it myself :/
Thanks
Melissa
Posted: Wed Apr 16, 2003 10:27 am
by twigletmac
Have you looked at
hotscripts.com?
Mac
Posted: Thu Apr 17, 2003 9:53 pm
by m3mn0n
That's a pretty basic script, it shouldn't be too difficult to program:
Code: Select all
<form action="page2.php" method="post">
<input type=text name="Arrayїname]" value="">
<input type=text name="Arrayїage]" value="">
<input type=text name="Arrayїlocation]" value="">
<input type=text name="Arrayїgames]" value="">
<input type=text name="Arrayїbio]" value="">
<br>
<input type="submit" name="submit" value="Submit">
<br>
<br>
</form>
Code: Select all
<?php
/*
This page will handle the form
*/
if ($submit){
//trim the incoming data
$Array[name] = trim($Array["name"]); // name of user
$Array[age] = trim($Array["age"]); // user age
$Array[location] = trim($Array["location"]); // user location
$Array[games] = trim($Array["games"]); // list of games
$Array[bio] = trim($Array["bio"]); // short bio
$Array[ip] = $REMOTE_ADDR; // user ip for logging
// setting variables for DB access
$host = ""; // host, usualy localhost
$user = ""; // username of host
$pass = ""; // password of host
$db = ""; // database name
$table = ""; // table name inside the db
// connecting to the database
$link = mysql_connect ($host, $user, $pass);
// the database query
$query = "INSERT into $table values ('0', '$Array[name]', '$Array[age]', '$Array[location]', '$Array[games]', '$Array[bio]', '$Array[ip]')";
// checking if the database insertion was successful
if (mysql_db_query ($db, $query, $link)) {
echo "<center><u>Successful!</u>";
} else {
echo "<center>This query was <u>NOT</u> entered into the database!";
} // ending db query if statement
// closing the database connection
mysql_close ($link)
} // ending $submit if statement
?>
Code: Select all
# This is what the SQL part of this should look like
#
# Table structure for table `members`
#
CREATE TABLE members (
id int(8) NOT NULL auto_increment,
name tinytext NOT NULL,
age tinytext NOT NULL,
location tinytext NOT NULL,
games tinytext NOT NULL,
bio tinytext NOT NULL,
ip tinytext NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;
It's totally untested so if i screwed up, post it.
Enjoy.
