[SOLVED] Php code problems

This is a discussion on "[SOLVED] Php code problems" within the PHP Forum section. This forum, and the thread "[SOLVED] Php code problems are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Oct 14th, 2007, 13:41
Reputable Member
Join Date: Oct 2007
Location: Liverpool UK
Age: 29
Posts: 216
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] Php code problems

I have a large php file, with a form that has text fields & listmenus, i need the data input from the list menus & text fields to go directly into a mysql database but i seem to be getting errors. Can some one please help???


Below is what my mysql database looks like

CREATE DATABASE IF NOT EXISTS dbprofile;
USE dbprofile;
CREATE TABLE tbl_customer_data (photo VARCHAR(30), name VARCHAR(25), age VARCHAR(4), sex VARCHAR(30), sexual_orientationarea VARCHAR(40), area VARCHAR(50), postcode VARCHAR(20), sexual_interests VARCHAR(45), who_id_like_to_meet VARCHAR(55), about_me VARCHAR(150), what_i_look_like VARCHAR(150), contact_email_address VARCHAR(40));


Below is examples of the errors i am getting from my log file located in htdocs



[Sun Oct 14 14:31:21 2007] [error] [client 127.0.0.1] PHP Notice: Undefined index: what_i_look_like in C:\\webserver\\Apache2\\htdocs\\sexyencounters\\Pr ofile Creation.php on line 172
[Sun Oct 14 14:31:21 2007] [error] [client 127.0.0.1] PHP Notice: Undefined index: contact_email_address in C:\\webserver\\Apache2\\htdocs\\sexyencounters\\Pr ofile Creation.php on line 172

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.'','','','','','','','','')' at line 4



Below is my code:

PHP: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtmlxml:lang="en">
<head>
<title>Instant Messiging Chat</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/1.css" type="text/css" media="screen,projection" />
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
.style1 {color: #FF33CC}
-->
</style>
</head>
 
<body>
 <div id="header">
 
   <h1 class="right">&nbsp;</h1>
   <h1>&nbsp;</h1>
 
</div>
 
 <ul id="nav">
 
   <li class="right"><input value="Search..." type="text" /></li>
 
   <li><a href="MainPage.php">Main Page</a></li>
 
   <li><a href="Login.php">LogIn</a></li>
 
   <li><a href="admin/Sign Up.php">SignUp</a></li>
 
   <li><a href="Contact.php">Contact</a></li>
 
</ul>
 
 <div class="clear" />
 
 <div id="sidebar">
 
   <h2>Latest News or Comments</h2>
 
           <p class="news"><a href="#" class="more">Read More »</a>           </p>
 
<p class="news"><a href="#" class="more">Read More »</a>           </p>
 
<p class="news"><a href="#" class="more">Read More »</a>           </p>
 
   <h2>Quick Links</h2>
 
           <ul>
 
             <li><a href="index.php">Introduction</a></li>
 
             <li><a href="AboutUs.php">About Us</a></li>
 
             <li><a href="admin/Sign Up.php">SignUp</a></li>
 
             <li><a href="MainPage.php">Main Page</a></li>
 
   </ul>
 
           <h2>Search</h2>
 
           <input name="" type="text" value="Search..." />
 
 </div>
 
 <div id="content">
   <h2><a href="#" id="intro"><u>Please Create Your Profile</u></a></h2>
 
   <p>Here you can create your profile for use with our site. The more effort &amp; quality you insert into your profile, the more you enhance your chances of finding &quot;who&quot; your looking for, for &quot;what&quot; your looking for!</p>
      <p>Good luck! And remember this is your part of the site, so keep it up to date and accurate to ensure success in your naughty adventures.</p>
      <table width="847" height="714" border="0">
        <tr>
          <td valign="top"><table width="842" height="709" border="1" bordercolor="#FF00FF">
            <tr>
              <td height="87"><div align="center">
                <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','672','height','79','src','Create Profile animation 1/SWFAnimation1','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','Create Profile animation 1/SWFAnimation1' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="672" height="79">
                  <param name="movie" value="Create Profile animation 1/SWFAnimation1.swf" />
                  <param name="quality" value="high" />
                  <embed src="Create Profile animation 1/SWFAnimation1.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="672" height="79"></embed>
                </object>
</noscript></div></td>
            </tr>
            <tr>
              <td valign="top"><table width="833" border="0">
                <tr>
                  <td width="400" height="612" valign="top">
 
<?php 
 
$target 
"images2/"
$target $target basename$_FILES['photo']['name']); 
 
$pic=($_FILES['photo']['name']); 
 
mysql_connect("localhost""root""longstand") or die(mysql_error()) ; 
mysql_select_db("dbprofile") or die(mysql_error()) ; 
 
mysql_query("INSERT INTO `tbl_customer_data` VALUES ('$name', '$pic')") ; 
 
if(
move_uploaded_file($_FILES['photo']['tmp_name'], $target)) 

 
echo 
"The file "basename$_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"

else { 
 
echo 
"Sorry Andy There Was A Problem Uploading The File."

?> 
<?php
$con 
mysql_connect("localhost","root","longstand");
if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }
 
mysql_select_db("dbprofile"$con);
 
 
echo 
$_POST[name];
echo 
"<br />";
echo 
$_POST[age];
echo 
"<br />";
echo 
$_POST[sex]; 
echo 
"<br />";
echo 
$_POST[sexual_orientation];
echo 
"<br />";
echo 
$_POST[area];
echo 
"<br />";
echo 
$_POST[postcode];
echo 
"<br />";
echo 
$_POST[sexual_interests];
echo 
"<br />";
echo 
$_POST[who_id_like_to_meet];
echo 
"<br />";
echo 
$_POST[about_me];
echo 
"<br />";
echo 
$_POST[what_i_look_like ];
echo 
"<br />";
echo 
$_POST[contact_email_address];
echo 
"<br />";
 
 
$sql="INSERT INTO tbl_customer_data (name, age, sex, sexual_orientation, area, postcode, sexual_interests, who_id_like_to_meet, about_me, what_i_look_like, contact_email_address) 
VALUES
('$_POST[name]','$_POST[age]'.'$_POST[sex]','$_POST[sexual_orientation]','$_POST[area]','$_POST[postcode]','$_POST[sexual_interests]','$_POST[who_id_like_to_meet]','$_POST[about_me]','$_POST[what_i_look_like]','$_POST[contact_email_address]')"
;
 
if (!
mysql_query($sql,$con))
  {
  die(
'Error: ' mysql_error());
  }
 
 
 
mysql_close($con);
?>
<form action="Profile Creation.php" method="post" enctype="multipart/form-data" id="form1">
                    <p class="style1">Please Upload A Recent Photo Of Yourself</p>
                    <p>
                      <label>
                     <span class="style1">Photo:</span> 
                     <input type="file" name="photo"><br> 
                      </label>
                    </p>
                    <p>
                      <label><span class="style1">Go</span>
                      <input type="submit" name="photo" id="photo" value="Submit" />
                      </label>
                    </p>
                    <p class="style1">Please Insert Your Name</p>
                    <p>
                      <label>
                      <input type="text" name="name" id="name" />
                      </label>
                    </p>
                    <p class="style1">Please Insert Your Age</p>
                    <p>
                      <label>
                      <select name="age" id="age">
 
                                <option>18</option>
                                <option>19</option>
                                <option>20</option>
                                <option>21</option>
                                <option>22</option>
                                <option>23</option>
                                <option>24</option>
                                <option>25</option>
                                <option>26</option>
                                <option>27</option>
                                <option>28</option>
                                <option>29</option>
                                <option>30</option>
                                <option>31</option>
                                <option>32</option>
                                <option>33</option>
                                <option>34</option>
                                <option>35</option>
                                <option>36</option>
                                <option>37</option>
                                <option>38</option>
                                <option>39</option>
                                <option>40</option>
                                <option>41</option>
                                <option>42</option>
                                <option>43</option>
                                <option>44</option>
                                <option>45</option>
                                <option>46</option>
                                <option>47</option>
                                <option>48</option>
                                <option>49</option>
                                <option>50</option>
                                <option>51</option>
                                <option>52</option>
                                <option>53</option>
                                <option>54</option>
                                <option>55</option>
                                <option>56</option>
                                <option>57</option>
                                <option>58</option>
                                <option>59</option>
                                <option>60</option>
                                <option>61</option>
                                <option>62</option>
                                <option>63</option>
                                <option>64</option>
                                <option>65</option>
                                <option>66</option>
                                <option>67</option>
                                <option>68</option>
                                <option>69</option>
                                <option>70</option>
                                <option>71</option>
                                <option>72</option>
                                <option>73</option>
                                <option>74</option>
                                <option>75</option>
                                <option>76</option>
                                <option>77</option>
                                <option>78</option>
                                <option>79</option>
                                <option>80</option>
                                <option>81</option>
                                <option>82</option>
                                <option>83</option>
                                <option>84</option>
                                <option>85</option>
                                <option>86</option>
                                <option>87</option>
                        </select>
                      </label>
                    </p>
                    <p class="style1">Please Input Your Sex</p>
                    <p>
                      <label>
                      <select name="sex" id="sex">
                        <option>Male</option>
                        <option>Female</option>
                        <option>Trans Male</option>
                        <option>Trans Female</option>
                                            </select>
                      </label>
                    </p>
                    <p class="style1">Please Insert Your Sexual Orientation</p>
                    <p>
                      <label>
                      <select name="sexual_orientation" id="sexual_orientation">
                      <option>Straight Male</option>
                                <option>Straight Female</option>
                                <option>Bi Male</option>
                                <option>Bi Female</option>
                                <option>Gay Male</option>
                                <option>Gay Female</option>
                              </select>
                      </label>
                    </p>
                    <p class="style1">Please Insert Your Area</p>
                    <p>
                      <label>
                      <select name="area" id="area">
                       <option>England-Bath Avon</option>
                          <option>England-Bedforshire</option>
                          <option>England-Berkshire</option>
                          <option>England-Brighton</option>
                          <option>England-Bristol</option>
                          <option>England-Buckinghamshire</option>
                          <option>England-Cambridgeshire</option>
                          <option>England-Channel Isles</option>
                          <option>England-Cheshire</option>
                          <option>England-Cornwall</option>
                          <option>England-County Durham</option>
                          <option>England-Cumbria</option>
                          <option>England-Derbyshire</option>
                          <option>England-Devon</option>
                          <option>England-Dorset</option>
                          <option>England-Essex</option>
                          <option>England-Gloucestershire</option>
                          <option>England-Hampshire</option>
                          <option>England-Herefordshire</option>
                          <option>England-Huntingdonshire</option>
                          <option>England-Isle Of White</option>
                          <option>England-Isle Of Sily</option>
                          <option>England-Kent</option>
                          <option>England-Lancashire</option>
                          <option>England-Leicestershire</option>
                          <option>England-Lincolnshire</option>
                          <option>England-London</option>
                          <option>England-Manchester</option>
                          <option>England-Merseyside</option>
                          <option>England-Middlesex</option>
                          <option>England-Norfolk</option>
                          <option>England-Northamptonshire</option>
                          <option>England-Northumberland</option>
                          <option>England-Nottinghamshire</option>
                          <option>England-Oxfordshire</option>
                          <option>England-Rutland</option>
                          <option>England-Shropshire</option>
                          <option>England-Somerset</option>
                          <option>England-Staffordshire</option>
                          <option>England-Suffolk</option>
                          <option>England-Surrey</option>
                          <option>England-Sussex</option>
                          <option>England-Tyne &amp; Wear</option>
                          <option>England-Warwickshire</option>
                          <option>England-West midlands</option>
                          <option>England-Westmorland</option>
                          <option>England-Wiltshire</option>
                          <option>England-Worcestershire</option>
                          <option>England-Yorkshire</option>
                          <option>Isle Of Man</option>
                          <option>N Ireland-Artrim</option>
                          <option>N Ireland-Amagh</option>
                          <option>N Ireland-Bellfast</option>
                          <option>N Ireland-Down</option>
                          <option>N-Ireland-Femanagh</option>
                          <option>N-Ireland-Londondery</option>
                          <option>N-Ireland-Tyrone</option>
                          <option>Scotland-Aberdeenshire</option>
                          <option>Scotland-Angus</option>
                          <option>Scotland-Argylshire</option>
                          <option>Scotland-Ayrshire</option>
                          <option>Scotland-Banffshire</option>
                          <option>Scotland-Berwicshire</option>
                          <option>Scotland-Buteshire</option>
                          <option>Scotland-Caithness</option>
                          <option>Scotland-Clackmannanshire</option>
                          <option>Scotland-Dumfriesshire</option>
                          <option>Scotland-Dundee city</option>
                          <option>Scotland-Edinburgh</option>
                          <option>Scotland-Falkirk</option>
                          <option>Scotland-Fife</option>
                          <option>Scotland-Highland</option>
                          <option>Scotland-Inverness-shire</option>
                          <option>Scotland-Isle of Islay</option>
                          <option>Scotland-Isle of Lewis</option>
                          <option>Scotland-Isle of Skye</option>
                          <option>Scotland-Kincarineshire</option>
                          <option>Scotland-Kinross-shire</option>
                          <option>Scotland-Kirkcudbrightshire</option>
                          <option>Scotland-Lanarkshire</option>
                          <option>Scotland-Midlothian</option>
                          <option>Scotland-Morayshire</option>
                          <option>Scotland-Naimshire</option>
                          <option>Scotland-Orkney</option>
                          <option>Scotland-Peeblesshire</option>
                          <option>Scotland-Perthshire</option>
                          <option>Scotland-Renfrewshire</option>
                          <option>Scotland-Ross-shire</option>
                          <option>Scotland-Roxburghshire</option>
                          <option>Scotland-Selkirkshire</option>
                          <option>Scotland-Shetland</option>
                          <option>Scotland-Sterlingshire</option>
                          <option>Scotland-Sutherland</option>
                          <option>Scotland-West Lothiann</option>
                          <option>Scotland-Western Isles</option>
                          <option>Scotland-Wigtownshire</option>
                          <option>Wales-Anglesey</option>
                          <option>Wales-Brecknockshire</option>
                          <option>Wales-Caemarfonshire</option>
                          <option>Wales-Cardiff</option>
                          <option>Wales-Cardiganshire</option>
                          <option>Wales-Carmarthenshire</option>
                          <option>Wales-Ceredigion</option>
                          <option>Wales-Denbighshire</option>
                          <option>Wales-Flintshire</option>
                          <option>Wales-Glamorgan</option>
                          <option>Wales-Gwynedd</option>
                          <option>Wales-Merioneth</option>
                          <option>Wales-Monmouthshire</option>
                          <option>Wales-Montgomeryshire</option>
                          <option>Wales-Newport</option>
                          <option>Wales-Pembrokeshire</option>
                          <option>Wales-Radnorshire</option>
                          <option>Wales-Swansea</option>
                      </select>
                      </label>
                    </p>
                    <p class="style1">Please Insert Your Postcode (Capitals Only)</p>
                    <p>
                      <label>
                      <input type="text" name="postcode" id="postcode" />
                      </label>
                    </p>
                    <p class="style1">Please Input Your Sexual Interests</p>
                    <p>
                      <label>
                      <select name="sexual_interests" id="sexual_interests">
                      <option>1 on 1 Sexual Discreet Partner</option>
                                <option>Group Sex</option>
                                <option>Gay Male</option>
                                <option>Gay Female</option>
                                <option>Bi Male</option>
                                <option>Bi Female</option>
                                <option>Couples</option>
                                <option>Transvestite</option>
                                <option>BDSM\Fetish</option>
                      </select>
                      </label>
                    </p>
                    <p class="style1">Please Input Who You Would Like To Meet</p>
                    <p>
                      <label>
                      <textarea name="who_id_like_to_meet" id="who_id_like_to_meet" cols="45" rows="5"></textarea>
                      </label>
                    </p>
                    <p class="style1">Please Tell Us About Yourself</p>
                    <p>
                      <label>
                      <textarea name="about_me" id="about_me" cols="45" rows="5"></textarea>
                      </label>
                    </p>
                    <p class="style1">Please Describe What You Look LIke</p>
                    <p>
                      <label>
                      <textarea name="what_i_look_like" id="what_i_look_like" cols="45" rows="5"></textarea>
                      </label>
                    </p>
                    <p class="style1">Please Input A Discreet Email Address For Other members To Contact You About Your Naughty Interests</p>
                    <p>
                      <label>
                      <input type="text" name="contact_email_address" id="contact_email_address" />
                      </label>
                    </p>
                    <p>
                      <label>
                      <input type="submit" name="submit" id="submit" value="Submit" />
                      </label>
                    </p>
                    <p class="style1">Remember Keep Your Emails Private &amp;amp; Dont Get Caught Doing Anythink I Wouldnt Do &amp; He He</p>
                    <p>&nbsp;</p>
                  </form>
                    <p>&nbsp;</p>
                  <p>&nbsp;</p></td>
                  <td width="210" valign="top"><table width="215" height="279" border="1" bordercolor="#FF00FF">
                    <tr>
                      <td>&nbsp;</td>
                    </tr>
                  </table></td>
                  <td width="201">&nbsp;</td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      </table>
      <p>&nbsp;</p>
</div>
 <div id="footer">
 
       <p>Site Design by <a href="">AJL Online Services Business Developement Specialists</a>.<br />
                              <!-- you can delete below here -->
© All  copyrights reserved.</p>
 
</div>
</body>
</html>

Basically we have all seen a create profile form, for instance "myspace"
Its just my data is not going into the database, and the problem is bugging me..

Gratfull for any help

Attached is my php file
Attached Files
File Type: php Profile Creation.php (22.3 KB, 4 views)

Last edited by longstand; Oct 15th, 2007 at 09:50. Reason: Problem Solved
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Oct 15th, 2007, 09:52
Reputable Member
Join Date: Oct 2007
Location: Liverpool UK
Age: 29
Posts: 216
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Php code problems

I have solved my problem
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Oct 15th, 2007, 10:07
Highly Reputable Member
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Php code problems

go you!

It would help others with the same problem if you could post your solution.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Oct 15th, 2007, 10:53
Highly Reputable Member
Join Date: Jul 2006
Location: Devon, England
Posts: 565
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Php code problems

Yes...I would like to know what the problem was
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
what are the potential problems taking over another developers code? marsbar PHP Forum 3 Jan 31st, 2008 16:03