Alright, let me start off by saying this is my first post. I am unsure if I'm even in the right place here, but I need help and this is frustrating me to no end. So I called it quits and decided to ask for help.
What do I need? The title says it all. I'll show you what I have and tell me what I'm doing wrong and give me examples of how to do it right. This is just to further my MySQL/PHP knowledge until I start college. If you don't notice from my post, let me tell you: I am a noob.
A simple [for you?] code for letting my friends add their information into my database from the form on my website. [see my website if you want to see how it's currently working]. I use Xtreemhost.com by the way... :p
friendspost.php
<?php // Connect to the DB at Xtreemhost mysql_connect("sql200.xtreemhost.com", "*****", "*****") or die(mysql_error()); mysql_select_db("*****_friends") or die(mysql_error()); // Insert values from the form into the table 'friends' on the 'database '*****_friends' $sql="INSERT INTO "friends" (name, age, fav_color, fav_food, pet) VALUES ('$_POST[name]','$_POST[age]','$_POST[fav_color]','$_POST[fav_food]','$_POST[pet]')"; ?> Website Form [html]
<form action="friendspost.php" method="post"> Name?<br /> <input type="text" name="name" /><br /> Age?<br /> <input type="text" name="age" /><br /> Favorite Color?<br /> <input type="text" name="fav_color" /><br /> Favorite Food?<br /> <input type="text" name="fav_food" /><br /> Favorite Pet?<br /> <input type="text" name="fav_food" /><br /> <input type="submit" /> </form>
I have the file 'friendspost.php' in the same directory as my .html file.