MySQL/PHP input from form to table in DB

Author Message
AcefaceRAWR

  • Total Posts : 1
  • Scores: 0
  • Reward points : 100
  • Joined: 9/8/2011
  • Status: offline
MySQL/PHP input from form to table in DB Thursday, September 08, 2011 11:30 AM (permalink)
0
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.

 
#1
    gjones

    • Total Posts : 2291
    • Scores: 136
    • Reward points : 97820
    • Joined: 6/5/2001
    • Location: Ottawa, Ontario, Canada
    • Status: offline
    Re:MySQL/PHP input from form to table in DB Sunday, July 01, 2012 10:28 AM (permalink)
    0
    Yes, I know this is an old post, I’m trying to clean up older posts that are unanswered.
    Did you ever figure this out?
     
    #2
      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 2 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2013 ASPPlayground.NET Forum Version 3.9