Did you give any height to this div in your CSS ? If yes, please remove;
please check Click Here
You can set this in your CSS,like
textarea {
overflow-y: scroll;
overflow-x: hidden;
}
Try this
function setMyValue ($myValue) {
$newValue = (int)$myValue;
$myArray = array_reverse(str_split($newValue));
$myValue ="";
foreach ($myArray as $key=>$myDigits) {
$myValue.=($key>0 && $key%2==0) ? ":" : "";
$myValue.= $myDigits;
}
return strrev($myValue);
}
echo setMyValue(91819.0);
Try this
<?php
$yt_url="http://www.youtube.com/watch?v=ZvzwthHh-IQ";
function get_youtube_id_from_url($url)
{
preg_match("/^(?:http(?:s)?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:(?:watch)?\?(?:.*&)?v(?:i)?=|(?:embed|v|vi|user)\/))([^\?&\"'>]+)/", $url, $matches);
return $matches[1];
}
$variable= get_youtube_id_from_url($yt_url);
echo "<div align='center'><iframe src=\"//www.youtube.com/embed/" . $variable. "\" style=\"background: #fff;\" frameborder=\"0\" height=\"300\" scrolling=\"auto\" width=\"480\"></iframe></div>";
?>
facebook will crawl your website URL for to get the title, description, and thumbnail.
when you test with localhost, change the the URL http://localhost/ to http://127.0.0.1/.
Did you echo $imageName=$_GET['image']; on page2.php ?
please show your page2 codes ...
Hai;
Try this
<form name="form1" method="post" action="#">
<label for="country">View outlets in which country? </label>
<select name="country_chosen" onchange="document.form1.submit()" id="country">
<option value="">All Middle Eastern Countries</option>
<option value="Iraq">Iraq</option>
<option value="Kuwait">Kuwait</option>
<option value="Bahrain">Bahrain</option>
<option value="Saudi">Saudi Arabia</option>
<option value="Qatar">Qatar</option>
<option value="Oman">Oman</option>
<option value="Yemen">Yemen</option>
<option value="Jordan">Jordan</option>
<option value="Israel">Israel</option>
</select>
</form>
<br>
<?php
$country_selected = '';
$country_selected = $_POST['country_chosen'];
echo "You have chosen to view outlets in " . $country_selected;
include ("inc/OutletsIn" . $country_selected .".php"); //Want to concatanate country name and .php to the end
?>
Change the above code to this
<td><input type="text" name="c1" value=" <?php if($p_id!="")echo $a; else echo $p_name; ?>" ></td>
Try this
<?php
$result = mysql_query("SELECT DATE_FORMAT(`joindate`,'%m/%Y') AS MonthYear FROM member GROUP BY YEAR(joindate), MONTH(joindate);");
while($row = mysql_fetch_array($result))
{
echo '<h2>'.$row['MonthYear'].' </h2>';
$resultTwo = mysql_query("SELECT * FROM member WHERE DATE_FORMAT(`joindate`,'%m/%Y') = '{$row['MonthYear']}';");
while($rowTwo = mysql_fetch_array($resultTwo)) {
echo '<p>Member: '.$rowTwo['name'].' </p>';
echo '<p>Email: '.$rowTwo['email'].' </p>';
echo '<p>Joindate: '.$rowTwo['joindate'].' </p><hr />';
}
}
?>
Try this
<?php
//table Name
$tableName = "MyTable";
//database name
$dbName = "MyDatabase";
$conn = mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db($dbName) or die(mysql_error());
//get the first row fields
$fields = "";
$fieldsInsert = "";
if (($handle = fopen("test.csv", "r")) !== FALSE) {
if(($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
$fieldsInsert .= '(';
for ($c=0; $c < $num; $c++) {
$fieldsInsert .=($c==0) ? '' : ', ';
$fieldsInsert .="`".$data[$c]."`";
$fields .="`".$data[$c]."` varchar(500) DEFAULT NULL,";
}
$fieldsInsert .= ')';
}
//drop table if exist
if(mysql_num_rows(mysql_query("SHOW TABLES LIKE '".$tableName."'"))>=1) {
mysql_query('DROP TABLE IF EXISTS `'.$tableName.'`') or die(mysql_error());
}
//create table
$sql = "CREATE TABLE `".$tableName."` (
`".$tableName."Id` int(100) unsigned NOT NULL AUTO_INCREMENT,
".$fields."
PRIMARY KEY (`".$tableName."Id`)
) ";
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not create table: ' . mysql_error());
}
else {
while(($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
$fieldsInsertvalues="";
//get field values of each row
for ($c=0; $c < $num; $c++) {
$fieldsInsertvalues .=($c==0) ? '(' : ', ';
$fieldsInsertvalues .="'".$data[$c]."'";
}
$fieldsInsertvalues .= ')';
//insert the values to table
$sql = "INSERT INTO ".$tableName." ".$fieldsInsert." VALUES ".$fieldsInsertvalues;
mysql_query($sql,$conn);
}
echo 'Table Created';
}
fclose($handle);
}
?>
I tested your above code in my local pc. It works fine.Make sure that "$data['content']" having contents or check your database table structure.
I have done an example here .
In your php file
<?php
class SimpleXMLElement_Plus extends SimpleXMLElement {
public function addMyCss( $name, $value )
{
$dom_sxe = dom_import_simplexml($this);
$dom_parent = $dom_sxe->ownerDocument;
$xpath = new DOMXPath($dom_parent);
$first_element = $xpath->evaluate('/*[1]')->item(0);
$pi = $dom_parent->createProcessingInstruction($name, $value);
$dom_parent->insertBefore($pi, $first_element);
}
}
$xml = new SimpleXMLElement_Plus('<xml/>');
$xml->addMyCss('xml-stylesheet', 'type="text/css" href="markers.css"');
$track = $xml->addChild('markers');
for ($i = 1; $i <= 10; ++$i) {
$marker = $xml->addChild('marker');
$marker->addChild('name', "name$i");
$marker->addChild('address', "address $i");
$marker->addChild('lat', "lat $i");
$marker->addChild('lng', "lng $i");
}
Header('Content-type: text/xml');
print($xml->asXML());
?>
& in your markers.css
markers
{
margin:10px;
background-color:#ccff00;
font-family:verdana,helvetica,sans-serif;
}
name
{
display:block;
font-weight:bold;
}
address, lat, lng
{
display:block;
color:#636363;
font-size:small;
font-style:italic;
}
Hai;
Try this
<?php
include("config.php");
function runQry ($qry){
$rows = array();
$result = mysql_query($qry);
if($result) {
while($row = mysql_fetch_object($result)) {
$rows[] = $row;
}
} else {
$rows = null;
}
return $rows;
}
function getAllMenus ($level=0) {
$menuList=array();
$sql="SELECT * FROM `tbl_structure` WHERE `PARENTID` = '$level'";
$mainMenus=runQry($sql);
foreach($mainMenus as $mm) {
array_push($menuList, $mm);
$subMenu=getAllMenus($mm->ID);
if(sizeof($subMenu)>0) {
array_push($menuList, $subMenu);
}
}
return $menuList;
}
function generateTree($menuList) {
$length=sizeof($menuList);
$tree="<ul>";
foreach($menuList as $i=>$ml) {
if(is_array($ml)) {
$tree=substr($tree, 0, -5);
$tree.=generateTree($ml);
$tree.="</li>";
}
else {
$tree.="<li><a href='prodid=".$ml->ID."'>".strtoupper($ml->NAME)."</a></li>";
}
}
$tree.="</ul>";
return $tree;
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="testcss.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
echo generateTree(getAllMenus());
?>
</body>
</html>
Try the following example:
Create a folder in your root, Here we named it as upload.In this folder we are uploading text file.
In you form html
<html>
<body>
<table align="center">
<form action="upload_page.php" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
</form>
</table>
</body>
</html>
And your upload_page.php
<?php
//Your Data base connections
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
mysql_select_db($db) or die ("Unable to select database!");
//upload file to upload folder
$uploaddir = 'upload/';
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
//if upload is success
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
//read file
$fp = fopen($uploadfile, 'rb');
while ( ($line = fgets($fp)) !== false) {
$sql = "INSERT INTO file_tbl (file_data) VALUES '".mysql_real_escape_string($line)."'";
mysql_query( $sql);
}
} else {
echo "Error in file upload";
}
?>
Hai;
Try this
<script src="http://code.jquery.com/jquery-1.8.1.js"></script>
<?php
//require_once("connect.php");
// DELETE
if(isset($_POST['delete']))
{
echo '<h1>Posted Value ='.$_POST['delete'].'</h1>';
}
?>
<form name="form1" id="formId" action="" method="post">
<input name="delete" type="hidden" value="Deleted" />
<table border=0; cellpadding="1" cellspacing="1" bgcolor="" align="center" >
<div style=text-align:center;margin-top:20px;>
<input type="button" name="delete" value="Delete" onclick="formConfirm()">
</div>
</table>
</form>
<script type="text/javascript">
function formConfirm() {
if(!confirm("Do you really want to delete this record?")) return false;
$("#formId").submit();
}
</script>
Do the following changes
<?php
global $con;
require_once("connect.php");
$productValue="";
$productWeight="";
$productCode = "";
if(isset($_POST['button1']))
{
// Get values from form
$sno =$_POST['txtsno'];
$record_check ="SELECT * FROM test WHERE sno = '$sno' ";
$result=mysqli_query($con, $record_check);
$row = mysqli_fetch_array($result);
if(!$row)
die ('No record Found');
else {
$productValue = $row['packing'];
$productWeight = $row['weight'];
$productCode = $sno;
}
}
?>
<!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=iso-8859-1" />
<title>Display data in textboxes</title>
<style type="text/css">
html {
overflow:auto;
}
body {
background-color:#FFFFFF;
margin:0 auto;
}
#mypopup
{
float: left;
width: 250px; height: 350px;
background: #90bade;
border: 1px solid #069;
text-align:center;
padding:2px;
margin-top:150px;
margin-left:100px;
overflow:auto;
}
#header
{
background-color:#3399FF;
background-position:left center;
line-height:25px;
font-size:22px;
color:#FFFF33;
font-weight:600;
border-bottom:1px solid #6699CC;
padding:10px;
}
</style>
</head>
<body>
<center>
<div id="mypopup">
<div id="header">Search Data</div>
<div style="margin-top:80px;">
<form name="form1" action="#" method="post">
<table border=0; cellpadding="1" cellspacing="1" bgcolor="#CCFFFF" align="center" >
<tr>
<td>Code</td>
<td width="50px"><input type="text" name="txtsno" id="txtsno" value="<?php echo $productCode ; ?>" title="Enter product code" onkeypress="validate(event)" ; onfocus="this.select()" /></td>
</tr>
<tr>
<td>Product</td>
<td><input type="text" name="txtpro" value="<?php echo $productValue; ?>" title="Enter product name" ></td>
</tr>
<tr>
<td>Weight</td>
<td><input type="text" name="txtwet" value="<?php echo $productWeight; ?>" title="Enter product weight" onfocus="this.select()" ></td>
</tr>
</table>
<div style=text-align:center;margin-top:20px;>
<input type="submit" name="button1" value="Display" >
<input type="reset" name="button2" value="Clear" >
</div>
</form>
</div>
</div>
</center>
<?php
mysqli_close($con);
?>
</body>
</html>
And also made changes in connect.php
<?php
// Connection variables
$host="localhost";
$username="root";
$password="";
$db_name="DatabaseName";
// Connect to database
$con=mysqli_connect("$host", "$username", "$password", "$db_name");
// Connect result
if(!$con){
die('Error Connecting to …
I think, You assign the result to an array, and you try to use the array as an object.
Check this link Click Here.
You Can do this with AJAX
Check the below example :
Your form page (formpage.php)
<!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=iso-8859-1" />
<title>BROWSE DATA</title>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<style type="text/css">
html {
overflow:auto;
}
body {
background-color:#FFFFFF;
margin:0 auto;
}
#mypopup2
{
float: left;
width: 250px; height: 350px;
background: #90bade;
border: 1px solid #069;
text-align:center;
padding:2px;
margin-top:150px;
margin-left:50px;
overflow:auto;
}
#header
{
background-color:#3399FF;
background-position:left center;
line-height:25px;
font-size:22px;
color:#FFFF33;
font-weight:600;
border-bottom:1px solid #6699CC;
padding:10px;
}
.design12 {
background-image:url(Images/disk.png);
background-position:left center;
background-repeat:no-repeat;
background-color:#FF9;
border:1px solid #88de85;
-webkit-border-radius:7px;
-moz-border-radius:7px;
font-size:15px;
font-weight:700;
font-family:verdana;
color:#0d5f83;
width:100px;
cursor:hand;
padding:9px;
}
.design13 {
background-image:url(Images/reload_16.png);
background-position:left center;
background-repeat:no-repeat;
background-color:#CF9;
border:1px solid #88de85;
-webkit-border-radius:7px;
-moz-border-radius:7px;
font-size:15px;
font-family:verdana;
font-weight:700;
color:#0d5f83;
width:100px;
cursor:hand;
padding:9px;
}
.txt
{
width:150px;
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
font-weight:300;
}
td
{color:#6600CC;}
</style>
</head>
<body>
<div id="mypopup2" >
<div id="header"><img src="Images/book_open.png" align="left">Brows Data</div>
<div style="margin-top:10px;">
<form name="form1" id="form1" method="get" action="#">
<table border="1" cellpadding="1" cellspacing="1" bgcolor="silver" align="center" width="95%" id="myTable" >
<tr><th width="20%">Code</th>
<th width="50%">Product</th>
<th width="20%">Weight</th>
</tr>
</table>
<div style="margin-top:125px;text-align:center;margin-top:100px;">
<input type="submit" name="submit" value="Brow" class="design12">
<input type="hidden" name="request" value="getTableData" />
<input type="button" name="button2" value="Clear" class="design13">
</div>
</form>
<script type="text/javascript">
$(function() {
//remove all get values
$(".design13").click(function() {
$("#myTable").find("tr:gt(0)").remove();
});
//get values
$( "#form1" ).submit(function( event ) {
//clear previous result
$("#myTable").find("tr:gt(0)").remove();
$.post('request.php',$("#form1").serialize(),function(data) {
//display new result
$('#myTable').append(data);
});
event.preventDefault();
});
});
</script>
</div>
</div>
</body>
</html>
In your request.php
<?php
switch($_POST['request']) {
case 'getTableData':
//get the values from data base and echo the result …
Try this
$username = (isset($_POST['Username'])) ? $_POST['Username'] : "";
<?php
function hello() {
print "<h1>HELLO!</h1>";
print "<p>Welcome to my web site</p>";
}
hello();
?>
@tqmd1 You can do this using AJAX POST. (You don't change html to php).
Try the below code for index.html
<!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=iso-8859-1" />
<title>Connection Checking</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
</head>
<body>
<center>
<h1>Connection Checker</h1>
<fieldset style=width:300px;background-color:#E0FFFF>
<legend sytle=font-size:12;>Click Connect</legend>
<form name="form1" id="form1" method="post">
<table>
<tr><td></td><td align="center"><input type="submit" name="button1" value="Connect">
</td></tr>
</table>
</form>
</fieldset>
<h1 class="result"></h1>
</center>
<script type="text/javascript">
$(function () {
$("#form1").submit(function(e){
e.preventDefault();
$.post('connect.php',$('#form1').serialize(), function(data) {
$('.result').html(data);
alert (data);
});
});
});
</script>
</body>
</html>
Hai;
You are forgotten to echo the option value.
Please change this
<option value="<?php $x['id']?>" name="<?php $x['id']?>"><?php echo $x['display_name']?></option>
into
<option value="<?php echo $x['id']?>" name="<?php echo $x['id']?>"><?php echo $x['display_name']?></option>
If you want to print this result on same page..
please chage this
<form action="post.php" method="post">
into
<form action="" method="post">
@tqmd1
Please delete previous values from the table .. And test the above code again.
Try this
<?php
$dates = array("1/28/13","1/29/13","1/30/13","1/31/13");
foreach($dates as $myDate) {
$dueDate = date('n/j/y', strtotime("+1 months", strtotime($myDate)));
$myDateMonth = date ('n',strtotime($myDate));
$dueDateMonth = date('n', strtotime($dueDate));
$myDateYear = date ('Y',strtotime($myDate));
$dueDateYear = date ('Y',strtotime($dueDate));
if(($dueDateMonth - $myDateMonth)>1) {
if($myDateYear==$dueDateYear) $nextMonth = $myDateMonth+1;
else if($myDateYear<$dueDateYear) $nextMonth = 1;
$dueDateOrg = date("n/t/y", strtotime($nextMonth."/1/".$dueDateYear));
}
else {
$dueDateOrg = $dueDate;
}
echo $myDate." due date is ".$dueDateOrg."<br />";
}
?>
Try this
<?php
include("connect.php");
$check_insert_query = "SELECT * FROM ghee WHERE sno='18'";
$check_insert_result = mysql_query($check_insert_query);
$num_rows = mysql_num_rows($check_insert_result);
if($num_rows>0) {
die ("<p>Current SNO=18 already exists</p>");
}
else {
$insert_query = "INSERT INTO ghee (sno,pack,weight) VALUES (18,'kk',80)";
$insertion_result = mysql_query($insert_query);
//check whether the data insertion was successful
if(!$insertion_result)
{
die("Sorry! Something went wrong.</p>");
}
else
{
echo "<p>Record saved successfully.</p>";
}
}
mysql_close();
?>
Try this
<?php
mysql_connect("localhost", "root", "") or die("Connection failed! " . mysql_error());
mysql_select_db("your_database") or die("Error in database selection" . mysql_error());
function qryTry ($parentId) {
$find_query = "SELECT Id FROM Table_1 WHERE parent = '$parentId' ";
$strSQL = mysql_query($find_query);
while($row = mysql_fetch_array($strSQL)) {
echo $row['id'] . "<br />";
}
$strSQL2 = mysql_query($find_query);
while($row = mysql_fetch_array($strSQL2)) {
qryTry ($row['id']);
}
}
$parentValue = 4;
qryTry ($parentValue);
mysql_close();
?>
You can do this with ajax form submition. I have done some changes and it works.
Try the following example.
In your form page
<Html>
<head>
<title>Add two numbers on same form</title>
<script src="http://code.jquery.com/jquery-1.8.1.js"></script>
<body>
<center>
<h1><font color="blue"> Sum Two Numbers</font></h1>
<form name="thisform" method="post" id="myForm" action="getsum2.php" >
<table cellpadding=3 cellspacing=3>
<tr>
<td>Enter First Number</td><td><input type="Text" name="text1"></td>
</tr>
<tr>
<td>Enter Second Number</td><td><input type="Text" name="text2"></td>
</tr>
<tr>
<td style="color: #ff0000">Result</td><td><input type="Text" name="text2" id="txtResult" disabled></td>
</tr>
<tr>
<td colspan=2 align="center"><input type="submit" Value="Result"></td>
</tr>
</table>
</center>
<script type="text/javascript">
$("#myForm").submit(function(e) {
$.post('getsum2.php',$("#myForm").serialize(), function(data){
$("#txtResult").val(data);
});
e.preventDefault();
});
</script>
</body>
</html>
& In your getsum2.php
<?php
$num1=$_POST['text1'];
$num2=$_POST['text2'];
echo $result=$num1+$num2;
?>
You did double exicution of query.. I have done the changes and it works for me.
Please check ...
<?php
mysql_connect("localhost", "root", "") or die("Connection failed! " . mysql_error());
mysql_select_db("asia") or die("Error in database selection" . mysql_error());
echo "Connection successful!";
$find_query = "select *FROM ghee where sno=3";
$strSQL = mysql_query($find_query);
// Execute the query (the recordset $rs contains the result)
//$rs = mysql_query($strSQL);
// Loop the recordset $rs
// Each row will be made into an array ($row) using mysql_fetch_array
while($row = mysql_fetch_array($strSQL)) {
// Write the value of the column FirstName (which is now in the array $row)
echo $row['pack'] . "<br />";
}
mysql_close();
?>
You need to over write your url using .htaccess file
After that in on submit call a function like
<input type="submit" name="search_pro_btn" id="search_pro_btn" onclick="rewrite_form();" value="Search" />
In rewrite_form function,
function rewrite_form() {
//Create custom link here
----------------------------
----------------------------------
//create form submit action
var url = '/search/' +'your custom link';
document.getElementById('FormId').action = url;
document.FormId.submit();
}
Hai;
Use the following codes for rename the file name, if any file with same name exist on upload path.
$tempFile = $_FILES['txtFile']['tmp_name'];
$targetPath = 'uploadfolder/';
$newFileName =$_FILES['txtFile']['name'];
$targetFile = str_replace('//','/', $targetPath) . $newFileName;
$cpy=0;
do {
if($cpy>0)
$fileName="copy_".$cpy.str_replace(' ','_', ((isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name']))? $_FILES['file']['name'] : $_FILES['Filedata']['name']));
else $fileName=str_replace(' ','_', ((isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name']))? $_FILES['file']['name'] : $_FILES['Filedata']['name']));
$targetFile = str_replace('//','/',$targetPath) .$fileName;
$cpy++;
}while(is_file($targetFile));
move_uploaded_file($tempFile,$targetFile);
Hai;
The below link will help youhttp://jenniferperrin.com/blog/jquery-tutorial-popup-modal-contact-form/
Hai;
You use a hidden field for store this total value in your form.Like
<input type="hidden" name="hdnTotal" id="hdnTotal" value="" />
And also add the below code in your calculateSum().
$("#hdnTotal").val(sum5.toFixed(2));
In your action page you will get the total value as
$_POST['hdnTotal'] //if you use post methode
$_GET['hdnTotal'] // if you user get methode
Hai;
I have done some changes on your code. Please check.I think it will help you.
<?php
// if something was posted, start the process...
if(isset($_POST['upload']))
{
// define the posted file into variables
$name = $_FILES['picture']['name'];
$tmp_name = $_FILES['picture']['tmp_name'];
$type = $_FILES['picture']['type'];
$size = $_FILES['picture']['size'];
// get the width & height of the file (we don't need the other stuff)
list($width, $height, $typeb, $attr) = getimagesize($tmp_name);
// if width is over 600 px or height is over 500 px, kill it
if($width>600 || $height>500)
{
echo $name . "'s dimensions exceed the 600x500 pixel limit.";
echo '<a href="form.html">Click here</a> to try again.';
die();
}
// if the mime type is anything other than what we specify below, kill it
if(!($type=='image/jpeg' || $type=='image/png' || $type=='image/gif' )) {
echo $type . " is not an acceptable format.";
echo '<a href="form.html">Click here</a> to try again.';
die();
}
// if the file size is larger than 350 KB, kill it
if($size>'350000') {
echo $name . " is over 350KB. Please make it smaller.";
echo '<a href="form.html">Click here</a> to try again.';
die();
}
// if your server has magic quotes turned off, add slashes manually
if(!get_magic_quotes_gpc()){
$name = addslashes($name);
}
// open up the file and extract the data/content from it
$extract = fopen($tmp_name, 'r');
$content = fread($extract, $size);
$content = addslashes($content);
fclose($extract);
// connect to the database
include "connect.php";
// the query that will add this to the database
$addfile = "INSERT INTO files (name, size, type, content ) ".
"VALUES ('$name', '$size', …