Share on Google+Share on Google+

Form for Update Customization.

Advertisement
In this example you will learn about form for update customization.

Form for Update Customization

In this example, you will learn to make a update customization form in PHP. The code for customization update will be called on HTML form. 

In the following program, we have made a program for updating logo, theme, contact us, support, home page text, and RSS feed. 

<?php
#include common.php for connection
include("../../common.php");
?>

HTML action form

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<title>List Customization</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<body>
<center><h1> Update Customization </h1></center>

<form action="" method="post" name="" id="">
<table style="border:1px solid #CCCCCC; background-color:#F0F0F0; font-family:verdana; font-size:12px" cellpadding="5" cellspacing="2" width="400px"> 

<?php
$resellermail= $_SESSION["reseller_id"];
$link= mysql_connect($cmn_host,$cmn_user,$cmn_password) or die("Could not connect: ".mysql_error());
mysql_select_db($cmn_database,$link) or die("Error in selecting the database:".mysql_error());

$sql1="select * from company where email='$resellermail'";
$compresult = mysql_query($sql1) or exit('$sql failed: '.mysql_error()); 
$num_rows=mysql_fetch_array($compresult);
$compid=$num_rows["company_id"];


$sql="select id,company_id,logo,theme_id,contactus,support,homepagetext,rss_feed from customization where company_id ='$compid' order by id";
$result=mysql_query($sql,$link) or die(mysql_error());

while($row=mysql_fetch_array($result)) {
$comid = $row['company_id'];
$theme_id = $row["theme_id"];
$imagename = $row['logo'];

$comprow=mysql_fetch_array(mysql_query("select name from company where company_id='$comid';",$link));
$compname = $comprow["name"];

?>
<tr> 
<td style="border:1px solid #999999" bgcolor="#ABC2E9"><strong>Logo</strong></td>
<td><input type="image" src='images/<?=$imagename?>' size="20" height='100' width='150'></td>
</tr>
<? 
if($theme_id==1)
$color="Black";
else if($theme_id==2)
$color="Red";
else if($theme_id==3)
$color="Blue";
else if($theme_id==4)
$color="green";
else if($theme_id==5)
$color="yellow";?>

<tr>
<td style="border:1px solid #999999" bgcolor="#ABC2E9"><strong>Theme</strong></td>
<td><?php echo $color; ?></td>
</tr>
<tr>
<td style="border:1px solid #999999" bgcolor="#ABC2E9"><strong>Contact Us</strong></td>
<td><?php echo $row['contactus']; ?></td>
</tr>
<tr>
<td style="border:1px solid #999999" bgcolor="#ABC2E9"><strong>Support</strong></td>
<td><?php echo $row['support']; ?></td>
</tr>
<tr>
<td style="border:1px solid #999999" bgcolor="#ABC2E9"><strong>Home Page Text</strong></td>
<td><?php echo $row['homepagetext']; ?></td>
</tr>
<tr>
<td style="border:1px solid #999999" bgcolor="#ABC2E9"><strong>Rss Feed </strong></td>
<td><?php echo $row['rss_feed']; ?></td>
</tr>
<tr>
<td ></td><td><a href="<?php echo "addcustomization.php?id=".$row['id']."&mode=edit"?>">Update</a></td>
</tr>
<?php } ?>
</table>
</form>
</body>
</html>

Advertisements

Advertisement

Posted on: July 30, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.