943,998 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Unsolved
  • Views: 3398
  • MySQL RSS
Oct 30th, 2007
0

Cannot get php script to enter data

Expand Post »
I am trying to use this script to enter data into my database from an html form.
MySQL Syntax (Toggle Plain Text)
  1.  
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  3.  
  4. <html>
  5. <head>
  6.  
  7. <title>Item Entry - Opulentworx - Private</title>
  8.  
  9. </head>
  10.  
  11. <body>
  12.  
  13. <form action="/php/itemENTRY.php" method="post" id="itemENTERdb">
  14. <input type="text" id="itemNUM"/>Item #<br>
  15. <input type="text" id="quant"/>Quantity<br>
  16. <input type="text" id="date"/>Date<br>
  17. <input type="text" id="cost"/>Cost<br>
  18. <input type="text" id="ground"/>UPS Ground<br>
  19. <input type="text" id="3day"/>3 DAY UPS<br>
  20. <input type="text" id="2day"/>2 DAY UPS<br>
  21. <input type="text" id="nextDAY"/>Next DAY UPS<br>
  22. <input type="text" id="salesTAX"/>Sales Tax<br>
  23. <input type="text" id="dFEE"/>Design Fee<br>
  24. <input type="text" id="pFEE"/>Print Fee<br>
  25. <input type="text" id="markUP"/>Mark-UP<br>
  26. <input type="text" id="subTOT"/>Sub-Total<br>
  27. <input type="text" id="flTAX"/>FL Tax<br>
  28. <input type="submit" value="Save Date"/>
  29. <input type="reset" value="Reset Date"/>
  30. </form>
  31.  
  32.  
  33.  
  34. </body>
  35. </html>

MySQL Syntax (Toggle Plain Text)
  1. <?
  2. $link = mysql_connect("mysql","user","XXXXXXXX");
  3. if (!$link)
  4. {
  5. die('Could not connect: ' . mysql_error());
  6. }
  7.  
  8. mysql_select_db("prodINFO", $link);
  9. $sql="INSERT INTO 'table1' ('itemNUM', 'quant', 'date', 'cost', 'ground', '3day', '2day', 'nextDAY', 'salesTAX', 'dFEE', 'pFEE', 'markUP', 'subTOT', 'flTAX')
  10. VALUES ('$_POST["itemNUM"]', '$_POST["quant"]', '$_POST["DATE"]', '$_POST["cost"]', '$_POST["ground"]', '$_POST["3day"]', '$_POST["2day"]', '$_POST["nextDAY"]', '$_POST["salesTAX"]', '$_POST["dFEE"]', '$_POST["pFEE"]', '$_POST["markUP"]', '$_POST["subTOT"]', '$_POST["flTAX"]')";
  11. }
  12.  
  13. if (!mysql_query($sql,$link))
  14. {
  15. die('Error: ' . mysql_error());
  16. }
  17. echo "1 record added";
  18.  
  19. mysql_close($link);
  20.  
  21. ?>

can anyone tell me why it won't work?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jamez333 is offline Offline
3 posts
since Oct 2007
Oct 31st, 2007
0

Re: Cannot get php script to enter data

When you won't work. Tell us exactly what you mean?!
Last edited by iamthwee; Oct 31st, 2007 at 7:33 pm.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Nov 1st, 2007
0

Re: Cannot get php script to enter data

general mistake :

change $_post tags to $_request

you already posted the values... why you post them again on page itemENTRY.php

funny
Reputation Points: 6
Solved Threads: 19
Posting Whiz in Training
fatihpiristine is offline Offline
283 posts
since Sep 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: UK postcodes
Next Thread in MySQL Forum Timeline: multiple search terms+fulltext search





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC