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/xhtml" xml: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"> </h1>
<h1> </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 & quality you insert into your profile, the more you enhance your chances of finding "who" your looking for, for "what" 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 & 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; Dont Get Caught Doing Anythink I Wouldnt Do & He He</p>
<p> </p>
</form>
<p> </p>
<p> </p></td>
<td width="210" valign="top"><table width="215" height="279" border="1" bordercolor="#FF00FF">
<tr>
<td> </td>
</tr>
</table></td>
<td width="201"> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<p> </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