As you probably know im a php noob but I want to know the code for the following.
A kind of form where you submit your
Name:
Site:
Description:
Then everyone else can view it.
Thanks, rep for all helpers.

As you probably know im a php noob but I want to know the code for the following.
A kind of form where you submit your
Name:
Site:
Description:
Then everyone else can view it.
Thanks, rep for all helpers.
If no-one helps, message me on MSN when I come on and ill make the code for you.
Thats a contact form which uses the mail() function.
How will this enable
He needs a regular script made which inserts the data into an SQL database and then display the data on a different page.That veryone else can view it.
I still need help so can you msn me whn your on? Ill be on appear offline.
I have a sandbox that I made that will do a pretty basic version of that
do you just want a linear view, like
or something else?Name
Info
Info2
Info3
-----------
Name
Info
Info2
Info3
-----------
Name
Info
Info2
Info3
-----------
Name
Info
Info2
Info3
-----------
Name
Info
Info2
Info3
some like this: http://colin-roberts.net/v2/show.php
.:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
.:.: Stand up for what is right, even if you stand alone:.:.
Can you use MySQL databases?
Okay, I just tested this on my host, but I'm half asleep and I don't know if it'll work for you... it's also only half of the code (it'll do the database portion, but you won't see anything)
---------------------------------------------------------------
First log into your host and make a database, write down the name. Then create a table in that database, with these settings:
and fill it with these values:
You should now have a database name, a username, a password, and a table name.
form.html
processor.phpCode:<form action="processor.php" method="post"> First Name: <input type="text" name="first"><br /> Last Name: <input type="text" name="last"><br /> Hometown: <input type="text" name="home"><br /> Status: <input type="text" name="status"><br /> Grade: <select name="grade"> <option></option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> <option>NA</option> </select><br /> School: <input type="text" name="school"><br /> Sex: <select name="sex"> <option>M</option> <option>F</option> </select><br /> Favourite Town: <input type="text" name="town"><br /> Favourite Color: <input type="text" name="color"><br /> Best Friend(s): <input type="text" name="friends"><br /> Pets: <input type="text" name="pets"><br /> Siblings: <input type="text" name="siblings"> <br /> <input type="submit" name="submit" value="Submit"> <input type="reset" name="reset" value="Reset"> </form>
rest coming soon, or someone else can write it. G'nightPHP Code:<?php
#-----------------------Config Variables---------------------------
$sitename = "localhost"; // Change only if your database is not on the same host as this page
$username = "myusername"; // Change this to your username
$password = "mypass"; // Change this to your password
$dbname = "database"; // Change this to your database name
#---------------------Connect to Database--------------------------
if ( $sqldb = mysql_connect($sitename, $username, $password ) ) {
print "Connection complete<br>";
}
else {
die ("Unable to connect to database. Error: <b>".mysql_error()."</b>");
}
if ( mysql_select_db( $dbname, $sqldb ) ) {
print "Select of database complete!<br>";
}
else {
die ("Select of database failed. Error number: <b>".mysql_errno()." Message: ".mysql_error()."</b>");
}
#-----------------Set user-defined variables-----------------------
$fir = $_POST['first'];
$lat = $_POST['last'];
$hom = $_POST['home'];
$sta = $_POST['status'];
$gra = $_POST['grade'];
$sch = $_POST['school'];
$sex = $_POST['sex'];
$tow = $_POST['town'];
$col = $_POST['color'];
$fri = $_POST['friends'];
$pet = $_POST['pets'];
$sib = $_POST['siblings'];
#-----------------Insert the data into the database-----------------
$query = 'INSERT INTO \''.$dbname.'\' (\'First\',\'Last\',\'Home\',\'Status\',\'Grade\',\'School\',\'Sex\',\'Town\',\'Color\',\'Friends\',\'Pets\',\'Siblings\')
VALUES ($fir,$lat,$hom,$sta,$gra,$sch,$sex,$tow,$col,$fri,$pet,$sib)';
mysql_query($query);
#-------------------Close the database - Important!-----------------
mysql_close($sqldb);
?>
if he wonts the code from mine he can have it.
.:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
.:.: Stand up for what is right, even if you stand alone:.:.
Members who have read this thread: 0Want to hide these adverts? Register an account for free!