I'm new to PHP & programming, so please bear with me. I'm trying to
set up a page to take users information(address, a message and a
picture they upload), then sends it to a MySQL database. Right now I
have a HTML form , and a php page the HTML posts to (cleansend.php).
They are not working together for some reason. If someone could take
a look at the code bellow, any insights would be greatly appreciated.
Also, Does anyone know how to let users upload a picture with php &
how to save it in a file on the server?
Thanks
Here is the HTML form
<html>
<body>
<div align="center">
<img src="logo.bmp" /> </br>
<div align="center">
<img src="advertLink.bmp"/>
<img src="aboutusLink.bmp"/>
<img src="privacyLink.bmp"/> <br/> <br/>
<img src="pushmsg.bmp"/> <br/>
<form method="post" action="cleansend.php">
<img src="namelbl.bmp"/>
<input type="text" size="15" maxlength="30" id="name" /> <br/><br/>
<img src="addressline1lbl.bmp"/>
<input type="text" size="15" maxlength="30" id="adline1" />
<br/><br/>
<img src="addressline2lbl.bmp"/>
<input type="text" size="15" maxlength="30" id="adline2" />
<br/><br/>
<img src="citylbl.bmp" />
<input type="text" size="10" maxlength="30" id="city" /> <br/><br/>
<img src="statelbl.bmp" />
<input type="text" size="10" maxlength="30" id="state" /> <br/><br/>
<img src="zipcodelbl.bmp" />
<input type="text" size="5" id="zip" /><br/><br/>
<img src="countrylbl.bmp" />
<select id="country">
<option selected=""> </option>
<option> UK</option>
<option> Canada</option>
<option> Iraq</option>
<option> France</option>
<option> Mexico</option>
</select><br/><br/>
<img src="messagelbl.bmp"/><br/>
<textarea id="body" rows="15" cols="25" id="message" />
This message will go on the back of the postcard
</textarea></br>
<input type="image" src="button.bmp"/>
</form>
<br/>
</body>
</html>
Here is the php page, Cleansend.php
<html>
<body>
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$name=trim($_POST['name']);
$adline1=trim($_POST['adline1']);
$adline2=trim($_POST['adline2']);
$city=trim($_POST['city']);
$zip=trim($_POST['zip']);
nl2br($_POST['message']);
$name=stripslashes($name);
$adline1=stripslashes($adline1);
$adline2=stripslashes($adline2);
$city=stripslashes($city);
$zip=stripslashes($zip);
$message=stripslashes($_POST['message']);
$error="" ;
if ($error == "") {
echo "Thank you for using Pigeon Post. A pigeon has been dispatched
to your local post office." ;
}else{
echo "$error <P> Your card was NOT sent. Please hit the back button
to try again." ;
}
$time=time()
$link=
mysqli_connect ('localhost','root','google','PigeonPost');
$insert="INSERT INTO main
(time, name, adline1, adline2, city, zip, message)
VALUES
('$time','$name', '$adline1','$adline2','$city','$zip','$message' )";
mysql_query($insert);
$insert="INSERT INTO records
(time, adline1, adline2, city, zip)
VALUES
('$time','$name', '$adline1','$adline2','$city','$zip','$message' )";
mysql_query($insert);
mysqli_close($link);
$time="";
php?>
</body>
</html>
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/