I am making a form that allows a user to create a page that has a qr code to link it to the page. I am only having one problem, I cant get the picture to upload to the database and display after the form has been submitted. it displays the file name of the photo just not the photo.
here is my form code
<?php
ob_start();
session_start();
<html>
<head>
</head>
<title>create </title>
<center> <font size="+5"> Create </center>
<body background="">
<p
<table align="center" cellpadding="0" border="0" cellspacing="1">
<form name="createTeaOffer" action="submit.php" method="get">
<tr> <td> <font size="+3"> Headline:</td> <td> <input type="text" name="hea"> </td> </tr>
<br />
<tr> <td> <font size="+3"> Photo: </td> <td> <input type="file" name="pho"> </td> </tr>
<br />
<tr> <td><font size="+3">Description: </td> <td><input name="des" type="textarea"> </td> </tr>
<br />
<tr> <td><font size="+3">Contact Method: </td> <td> <input name="con" type="radio" value="email" name="email" >Email <input type="radio" value="phone" method="get" name="phone"> Phone </td> </tr>
<br />
<tr> <td><font size="+3">Email or Phone: </td> <td> <input name="ema" type="text"> </td> </tr>
<br />
<tr> <td><font size="+3">Location: </td> <td> <input name="loc" type="text"> </td> </tr>
<br />
<tr> <td><font size="+3">Expiration (yyyy-mm-dd): </td> <td> <input name="exp" type="date"> </td> </tr>
<br />
<tr> <td><font size="+3">Distance: </td> <td> <input name="dis" type="text"> </td></tr>
<br />
</font></table>
<input type="submit">
</form>
</body>
</html>
and here is my submit code
<?php
ob_start();
session_start();
$template = <<<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><!--TITLE--></title>
</head>
<body>
This page belongs to user $myusername<p><p>
QR Code: <img src="https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=http%3A%2F%2Fwww.url....%2F"<!--PAGENAME-->"&choe=UTF-8" title="Link to Google.com"><p>
Headline: <!--COMMENT--><p>
Photo: <!--PHOTO--><p>
Description: <!--DESC--><p>
Contact By: <!--CONBY--><p>
Contact information: <!--EMP--><p>
Location: <!--LOC--><p>
page expires on: <!--EXP--><p>
Distance: <!--DIS--><p>
<p>
Webpage URL: <!--PAGENAME-->
<p>
Please click <a href="/">Here</a> to go back to the homepage.
</body>
</html>
EOD;
//handle the posted form
if(isset($_POST['hea1'])&&isset($_POST['pho1'])){
//replace the areas of the template with the posted values
$page = str_replace('<!--TITLE-->',htmlentities($_POST['hea1']),$template);
$page = str_replace('<!--COMMENT-->',htmlentities($_POST['hea1']),$page);
$page = str_replace('<!--PHOTO-->',htmlentities($_POST['pho1']),$page);
$page = str_replace('<!--PAGENAME-->',htmlentities($_POST['wp1']),$page);
$page = str_replace('<!--DESC-->',htmlentities($_POST['des1']),$page);
$page = str_replace('<!--CONBY-->',htmlentities($_POST['con1']),$page);
$page =
str_replace('<!--EMP-->',htmlentities($_POST['ema1']),$page);
$page = str_replace('<!--LOC-->',htmlentities($_POST['loc1']),$page);
$page = str_replace('<!--EXP-->',htmlentities($_POST['exp1']),$page);
$page = str_replace('<!--DIS-->',htmlentities($_POST['dis1']),$page);
//create a name for the new page
$pagename = md5($_POST['hea1']).'.html';
//db connect & select
$db=mysql_connect('localhost','streich','U4iwcjn3Hi&d');
mysql_select_db('streich_users');
//check if page already exists
// $result = mysql_query('SELECT page_url from pages WHERE url="'.mysql_real_escape_string($pagename).'"');
// if(mysql_num_rows($result)>=1){
// $notice = '<p>Page already created <b>./pages/'.$pagename.'</b></p>';
// }else{
//inset new page into db
mysql_query('INSERT into pages (`page_name`,`disc`,`page_url`,`username`,
`start_date`,`end_date`,`location`,`email`,`phone`,`photo`)VALUES(
"'.mysql_real_escape_string(htmlentities($_POST['hea1'])).'",
"'.mysql_real_escape_string(htmlentities($_POST['dis1'])).'",
"'.$pagename.'","'.$myusername.'","'.mysql_real_escape_string(htmlentities($_POST['crd1'])).'",
"'.mysql_real_escape_string(htmlentities($_POST['exp1'])).'",
"'.mysql_real_escape_string(htmlentities($_POST['loc1'])).'",
"'.mysql_real_escape_string(htmlentities($_POST['ema1'])).'",
"'.mysql_real_escape_string(htmlentities($_POST['pho1'])).'")');
//put the created content to file
file_put_contents('./tearoffer/'.$pagename,$page);
//make a notice to show the user
$notice = '<p>New Page created <b>./page/'.$pagename.'</b></p>';
$fulllink = 'url/'.$pagename.'';
//header("location:/tearoffer/$pagename");
echo $fulllink;
?>
<img src="https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=http%3A%2F%2Fwww.url......%2Fpages%2F<? echo $pagename ?>&choe=UTF-8" title="Link"><p>
<?
// }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Make page example</title>
<style type="text/css">
.prevpage {
font-family: Arial, Helvetica, sans-serif;
font-size: 20px;
color: #093;
background-color: #333;
}
body {
}
</style>
</head>
<body>
<?php
//if the notice is set then display it
if(isset($notice)){echo $notice;} ?>
<ul><li class="prevpage"><b>Headline:</b> <?php echo $_GET['hea']; ?></li>
<li class="prevpage"></li>
<li class="prevpage"><b>Photo:</b> <?php echo $_GET['pho']; ?></li>
<li class="prevpage"></li>
<li class="prevpage"><b>Description:</b> <?php echo $_GET['des']; ?></li>
<li class="prevpage"></li>
<li class="prevpage"><b>Contact by:</b> <?php echo $_GET['con']; ?></li>
<li class="prevpage"></li>
<li class="prevpage"><b>E-Mail or Phone:</b> <?php echo $_GET['ema']; ?></li>
<li class="prevpage"></li>
<li class="prevpage"><b>Location:</b> <?php echo $_GET['loc']; ?></li>
<li class="prevpage"></li>
<li class="prevpage"><b>Expiration (yyyy-mm-dd):</b> <?php echo $_GET['exp']; ?></li>
<li class="prevpage"></li>
<li class="prevpage"><b>Distance:</b> <?php echo $_GET['dis']; ?></li>
</ul>/
<form method="POST" action="">
<input name="hea1" type="hidden" value="<?php echo $_GET['hea']; ?>">
<input name="pho1" type="hidden" value="<?php echo $_GET['pho']; ?>">
<input name="des1" type="hidden" value="<?php echo $_GET['des']; ?>">
<input name="crd1" type="hidden" value="<?php echo date("Y-m-d"); ?>">
<input name="con1" type="hidden" value=<?php echo $_GET['con']; ?>>
<input name="ema1" type="hidden" value=<?php echo $_GET['ema']; ?>>
<input name="loc1" type="hidden" value=<?php echo $_GET['loc']; ?>>
<input name="exp1" type="hidden" value=<?php echo $_GET['exp']; ?>>
<input name="dis1" type="hidden" value=<?php echo $_GET['dis']; ?>>
<input name="tst1" type="hidden" value="Thank you for using pages.">
<?php
echo '<input type="hidden" name="wp1" value="' . htmlspecialchars($pagename) . '" />'."\n";
?>
<input type="submit" value="submit preview">
</form>
</body></html>