Thread: Your old code?
View Single Post
Old 12-05-2007, 12:14 PM   #23 (permalink)
bdm
The Acquainted
Good Samaritan 
 
Join Date: Nov 2007
Posts: 127
Thanks: 14
bdm is on a distinguished road
Default

This is a snippet from my very first PHP site. It was done after reading a very basic tutorial at Code Walkers that only showed how to insert, update, delete and select rows from a database!
PHP Code:
<HTML>
<?php
if($submit)
{
$db mysql_connect("h""u""p");
mysql_select_db("db",$db);
$sql "INSERT INTO upcomingreleases (artist, albumname, label, labelsite, date) 
VALUES ('
$artist', '$albumname', '$label', '$labelsite', '$date')";
$result mysql_query($sql) or die (mysql_error());
echo 
"Thank you! Information entered.\n";
}
else
{
?>
<form method="post" action="a4addual57trlginoighh38478727bum.php">
<br>Artist:<input type="Text" name="artist"><br>
Album Name:<input type="Text" name="albumname"><br>
Record Label:<input type="Text" name="label"><br>
Record Label Website:<input type="Text" name="labelsite"><br>
Release Date:<input type="Text" name="date">

<input type="Submit" name="submit" value="Submit Upcoming Album"></form>
<?
}
?>
</HTML>
Also, take a look at the form action. Yeah, that's right! I didn't know how to make the admin authenticate to enter the admin panel, so I made some really obscure names in hopes that no one would ever figure them out. I simply had to tell the other administrator not to tell anyone.

LOL
bdm is offline  
Reply With Quote