View Full Version : Form results & database
paul s
03-11-2004, 06:29 PM
I have a question on how to post results from a form automatically on my web site. Here’s my situation. I have a sports web site that list scores from several local teams. The teams submit their scores via a form on my site, the results are then sent to my e-mail; I then copy the results and post them on my web site. Anyway to automate this process?
azlatin2000
03-11-2004, 06:44 PM
What scripting languages are available on your host?
Using mysql and php it would take a few minutes to make a form like the one you want.
If you don't know php/mysql just ask 4 help and me or someone else will probably help you out.
paul s
03-11-2004, 07:13 PM
My host supports the following scripts. SQL, PERL, PHP, Python.
I'm new at this advanced scripting; any help I can get would be appreciated.
azlatin2000
03-11-2004, 08:08 PM
It is 11 o clock here right now and i have school tomorow, if someone hasn't helped you by the time i come home i will make the script 4 you.
azlatin2000
03-12-2004, 12:04 PM
Run this once and then delete it:
<?php
$DB=mysql_connect("localhost","user","pass") or die(mysql_error());
mysql_select_db("db_name",$DB) or die(mysql_error());
mysql_query("CREATE TABLE TEAMPOINTS (TEAM varchar(50), POINTS INT)");
echo("this is some useless text that keeps the server from giving a 200 OK error");
?>
This is the page thyat will update everything (hopefully):
<?php
$DB=mysql_connect("localhost","user","pass") or die(mysql_error());
mysql_select_db("db_name",$DB) or die(mysql_error());
if(isset($POINTS)&&isset($TEAM)){
imysql_query("insert into TEAMPOINTS (TEAM,POINTS) values('$TEAM',$POINTS)") or die(mysql_error());
echo("points thing added");
}
$RESULT = mysql_query("SELECT * FROM TEAMPOINTS") or die(mysql_error());
while($ROW=mysql_fetch_array($RESULT)) {
echo("Team: ".$ROW['TEAM']." Has ".$ROW['POINTS']." Points<BR>\n");
}
?>
<FORM>
<INPUT TYPE="text" NAME="TEAM">
<INPUT TYPE="text" NAME="POINTS">
<INPUT TYPE=-"submit" value="submit">
</FORM>
As you can see this isa piece of crap because i am lazy but you can probably edit to so it fits your needs
vBulletin® v3.7.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.