<?php
$dbh = new PDO('mysql:host=localhost;dbname=test','root','');
$stmt = $dbh->prepare("INSERT INTO Writers (name) VALUES (:name)");
$stmt->bindParam(':name', $name);
$name = 'jeeva';
$stmt->execute();
$name = 'jeevanandham';
$stmt->execute();
?>
<script type='text/javascript'>
$(document).ready(function(){
$('#banner').submit(function(){
$('#imgbanner').attr('src','loading.gif');
});
$('iframe[name=upload_banner]').load(function(){
var result = $(this).contents().text();
if(result !=''){
$('#imgbanner').attr('src',$(this).contents().text());
}
});
});
function gob()
{
$('#bannerdiv').hide();
document.frmb.submit();
}
$(document).ready(function(){
$("#bbtn").click(function(){
$("#banner").click();
});
});
</script>
<style>
div#bannerdiv iframe {
position:fixed;
left:-9000px;
width:1px;
height:1px;
}
div#bannerdiv img {
max-width:150px;
max-height:150px;
}
</style>
<div class="banner">
<div id='bannerdiv' style="padding-left:200px; width:100px;">
<form id='bannerfrm' name="frmb" method='post' enctype='multipart/form-data' action='bannerupload.php' target='upload_banner'>
<p><input type='file' id='banner' name='banner' onchange="gob()" style="display:none;"/> </p>
</form>
<div id="bbtn" name="bbtn" style="background-color:#999999; border:2px double #666666; width:310px; height:100px;">Upload Banner</div>
</div>
<span style="padding-left:220px; padding-bottom:40px;"><img id="imgbanner" /></span>
<iframe name='upload_banner' style="display:none;">
</iframe>
</div>
In bannerupload.php
<?php
Scenario: Suppose if we used same click event function in various web pages. if you want do some logic some page button for that need to re...