Hi all
I have a problem. i am using adodb using mvc connection in php my page will get me the rows from the table where id =1 i need to replace the image file if it is exist. please help me anybody
<script language="javascript">
function DoPreview()
{
var filename = document.form1.btnLogoFile.value;
alert(filename);
var Img = new Image();
if (navigator.appName == "Netscape")
{
alert("Previews do not work in Netscape.");
}
else
{
Img.src = filename;
document.images[3].src = Img.src;
}
}
function show_table(showid)
{
if(showid=="horizontal"){
horizontal.className='visibleError';
//vertical.className='hiddenError';
}
}
function check()
{
var v =document.getElementById('horizontal');
alert(v.className);
if(document.form1.bname.value == "")
{
alert("Please Enter Business Name");
document.form1.bname.focus();
return false;
}
if(document.form1.cname.value == "")
{
alert("Please Enter Contact Name");
document.form1.cname.focus();
return false;
}
/* if((document.form1.eadd.value == "")||(document.form1.eadd.value.indexOf('@') == -1) ||
(document.form1.eadd.value.indexOf('.') == -1))
{
alert("Please Enter Email Address");
document.form1.eadd.focus();
return false;
}*/
if(v.className == 'visibleError')
{
if(document.form1.oldpass.value == "")
{
alert("Please Enter old password Name");
document.form1.oldpass.focus();
return false;
}
if(document.form1.newpass.value == "")
{
alert("Please Enter new password Name");
document.form1.newpass.focus();
return false;
}
if(document.form1.repass.value == "")
{
alert("Please Re Enter new password Name");
document.form1.repass.focus();
return false;
}
if(document.form1.newpass.value != document.form1.repass.value)
{
alert("ranjtih");
document.form1.repass.focus();
return false;
}
}
return true;
}
</script>
<form name="form1" method="post" action="processupdate.php" enctype="multipart/form-data">
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th scope="row">Business Name</th>
<td> </td>
<td>
<?php
$selectcouponlist = "SELECT businessname, contactname, address,email,company_logo,isadmin,date_created,date_modified FROM coupon_users WHERE user_id = 1";
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$couponlist = $db->Execute($selectcouponlist);
if($couponlist === false) die('query failed');
if($couponlist->RecordCount() < 1)
echo "<tr><td colspan='4'>No Coupons Found</td></tr>";
else {
# rs2html($couponlist);
# Coupon Title Coupon Created By Status Delete
$couponset = $couponlist->GetRows();
foreach($couponset as $coupon) {
/*echo "<tr>";
echo "<td>".$coupon['businessname']."</td>";
echo "<td>".$coupon['contactname']."</td>";
echo "<td><a class='tbllinks' href='mailto:".$coupon['email']."'>".$coupon['email']."</a></td>";
echo "<td>".$coupon['subscriber_id']."</td>";*/
/*
echo "<td>".$coupon['coupon_title']."</td>";
echo "<td>".$coupon['coupon_created_by']."</td>";
echo "<td><a href='mailto:".$coupon['coupon_status']."'>".$coupon['email']."</a></td>";
echo "<td>".$coupon['subscriber_id']."</td>";
*/
//echo "</tr>";
?>
<!--</table>-->
<input type="text" name="textfield" value="<?php print $coupon['businessname']; ?>">
</td>
</tr>
<tr><td> </td></tr>
<tr>
<th scope="row">Contact Name</th>
<td> </td>
<td> <input type="text" name="textfield2" value="<?php print $coupon['contactname'];?>"></td>
</tr>
<tr><td> </td></tr>
<tr>
<th scope="row">Address</th>
<td> </td>
<td> <textarea name="textarea" value="<?php print $coupon['address']; ?>"></textarea></td>
</tr>
<tr><td> </td></tr>
<tr>
<th scope="row">E Mail</th>
<td> </td>
<td> <input type="text" name="textfield3" value="<?php print $coupon['email']; }} ?>" size="50"></td>
</tr>
<tr><td> </td></tr>
<tr>
<th scope="row">Company Logo</th>
<td width="9%" class="Bodytext"><div align="center">:</div></td>
<td width="65%"><input type="file" name="btnLogoFile"><input type=button class=butn name=btn value="Preview" onClick="return DoPreview();"><br> <BR>
<img src="images/spacer.gif"></td>
</tr>
<tr><td> </td></tr>
<tr>
<th scope="row"> </th>
<td> </td>
<td><input type="submit" name="submit" value="Submit Info"></td>
</tr>
<tr><td> </td></tr>
<tr>
<th scope="row"> </th>
<td> </td>
<td> </td>
</tr>
<tr><td> </td></tr>
</table>
</form>
<?php
$var2 = microtime();
echo "<br>Elapsed Time: ".($var2 - $var1);
?>