ok, I have a script that allows a user to input information into an html form which submits that info to a php script which then puts that info into my mySQL database.
Currently it only allows the fields of: last name, first name,city, state, country, gender
I want to all ow the upload of images as well, one which will be displayed in the search results, i.e. Myspace when you search for people.
Also, how exactly should I set up the field in my database to allow this?
Here is the script:
HTML PART
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title></title>
</head>
<body>
<form action="http://ex-brief.com/insert/" method="post">
<table style="text-align: left; width: 70%;" border="0"
cellpadding="0" cellspacing="5">
<tbody>
<tr>
<td>First Name:</td><td><input
tabindex="1" name="first"></td>
<td>City</td><td><input tabindex="3" name="city"><br>
</td>
</tr>
<tr>
<td>Last Name:</td><td><input
tabindex="2" name="last"></td>
<td>State/Province:</td><td>
<select name="state">
<option>IL</option>
</select>
</td>
</tr>
<tr>
<td>Gender:</td><td><input name="gender"
value="Male" type="radio">Male
<input name="gender" value="Female"
type="radio">Female</td>
<td>Country:
</td><td>
<select name="country">
<option>IL</option>
</select>
</td>
</tr>
<tr>
<td><input name="searching" value="yes"
type="hidden">
</td>
<td></td>
</tr>
</tbody>
</table><P><input type="submit"></P>
</form>
</body>
</html>
PHP PART
Code:
<?php
$first=$_POST['first'];
$last=$_POST['last'];
$city=$_POST['city'];
$state=$_POST['state'];
$country=$_POST['country'];
$gender=$_POST['gender'];
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO contacts VALUES ('','$first','$last','$city','$state','$country','$gender')";
mysql_query($query);
if($query) {
echo "You have successfully created an ExBrief!";
} else {
echo "Your Ex Brief was not created. Please review the information you entered for accuracy.";
}
mysql_close();
?>
thanks!
|