PHP - Unable To Edit Html After Php
Hey guys,
After my php script a HTML code follows. But i can't edit the HTML code because it isn't recognised. It does show up, however i can't edit it. Problem: Unable to edit HTML code below php scripts Code: <?php function createNewFile($name,$mail,$subject,$comments,$count,$date,$other="",$up="0") { global $settings; $header=implode('',file('header.txt')); $footer=implode('',file('footer.txt')); $content=' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>'.$subject.'</title> <meta content="text/html; charset=windows-1250"> Thanks in advance Similar TutorialsLet me apologize in advance for what may seem like a very stupid question for most of you. I am very new to php. I am simply trying to view/html in a .PHP file using Alleycode text editor. When I download the file from the server to my local PC, open the file in Alleycode, I cannot see the HTML. All that I see is the PHP code. Can someone provide me with instruction on how I might view then edit the HTML? Here is the code from Alleycode: <?php /*******************************************************************\ * CashbackEngine v1.1 * http://www.CashbackEngine.net * * Copyright (c) 2010 CashbackEngine Software. All rights reserved. * ------------ CashbackEngine IS NOT FREE SOFTWARE -------------- \*******************************************************************/ session_start(); require_once("inc/config.inc.php"); require_once("inc/pagination.inc.php"); $results_per_page = RESULTS_PER_PAGE; $cc = 0; function getCategory($category_id, $description = 0) { if (isset($category_id) && is_numeric($category_id) && $category_id != 0) { $query = "SELECT name, description FROM cashbackengine_categories WHERE category_id='".(int)$category_id."'"; $result = smart_mysql_query($query); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result); if ($description == 1) return $row['description']; else return $row['name']; }else { return "Category not found"; } } else { if ($description != 1) return "Retailers"; } } ////////////////// filter ////////////////////// if (isset($_GET['column']) && $_GET['column'] != "") { switch ($_GET['column']) { case "title": $rrorder = "title"; break; case "added": $rrorder = "added"; break; case "visits": $rrorder = "visits"; break; case "cashback": $rrorder = "cashback"; break; default: $rrorder = "title"; break; } } else { $rrorder = "title"; } if (isset($_GET['order']) && $_GET['order'] != "") { switch ($_GET['order']) { case "asc": $rorder = "asc"; break; case "desc": $rorder = "desc"; break; default: $rorder = "asc"; break; } } else { $rorder = "asc"; } ////////////////////////////////////////////////// if (isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] > 0) { $page = (int)$_GET['page']; } else { $page = 1; } $from = ($page-1)*$results_per_page; $where = ""; if (isset($_GET['cat']) && is_numeric($_GET['cat']) && $_GET['cat'] > 0) { $cat_id = (int)$_GET['cat']; unset($retailers_per_category); $retailers_per_category = array(); $retailers_per_category[] = "111111111111111111111"; $sql_retailers_per_category = smart_mysql_query("SELECT retailer_id FROM cashbackengine_retailer_to_category WHERE category_id='$cat_id'"); while ($row_retailers_per_category = mysql_fetch_array($sql_retailers_per_category)) { $retailers_per_category[] = $row_retailers_per_category['retailer_id']; } $where .= "retailer_id IN (".implode(",",$retailers_per_category).") AND"; } if (isset($_GET['letter']) && in_array($_GET['letter'], $alphabet)) { $ltr = mysql_real_escape_string(getGetParameter('letter')); if ($ltr == "0-9") { $where .= " title REGEXP '^[0-9]' AND"; }else{ $ltr = substr($ltr, 0, 1); $where .= " UPPER(title) LIKE '$ltr%' AND"; } } $where .= " status='active'"; if ($rrorder == "cashback") $query = "SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY ABS(cashback) $rorder LIMIT $from, $results_per_page"; else $query = "SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY $rrorder $rorder LIMIT $from, $results_per_page"; $total_result = smart_mysql_query("SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY title ASC"); $total = mysql_num_rows($total_result); $result = smart_mysql_query($query); $total_on_page = mysql_num_rows($result); /////////////// Page config /////////////// $PAGE_TITLE = getCategory($_GET['cat']); require_once ("inc/header.inc.php"); ?> <h1><?php echo getCategory($_GET['cat']); ?></h1> <?php if ($total > 0) { ?> <p class="category_description"><?php echo getCategory($_GET['cat'], 1); ?></p> <div id="alphabet"> <ul> <li><a href="/retailers.php">All</a></li> <?php $numLetters = count($alphabet); $i = 0; foreach ($alphabet as $letter) { $i++; if ($i == $numLetters) $lilast = ' class="last"'; else $lilast = ''; if (isset($cat_id) && is_numeric($cat_id)) echo "<li".$lilast."><a href=\"/retailers.php?cat=$cat_id&letter=$letter\">$letter</a></li>"; else echo "<li".$lilast."><a href=\"/retailers.php?letter=$letter\">$letter</a></li>"; } ?> </ul> </div> <div class="browse_top"> <div class="sortby"> <form action="retailers.php" id="form1" name="form1" method="get"> <span>Sort by:</span> <select name="column" id="column" onChange="document.form1.submit()"> <option value="title" <?php if ($_GET['column'] == "title") echo "selected"; ?>>Name</option> <option value="visits" <?php if ($_GET['column'] == "visits") echo "selected"; ?>>Popular</option> <option value="added" <?php if ($_GET['column'] == "added") echo "selected"; ?>>Newest</option> <option value="cashback" <?php if ($_GET['column'] == "cashback") echo "selected"; ?>>Cashback</option> </select> <select name="order" id="order" onChange="document.form1.submit()"> <option value="desc"<?php if ($_GET['order'] == "desc") echo "selected"; ?>>Descending</option> <option value="asc" <?php if ($_GET['order'] == "asc") echo "selected"; ?>>Ascending</option> </select> <?php if ($cat_id) { ?><input type="hidden" name="cat" value="<?php echo $cat_id; ?>" /><?php } ?> <?php if ($ltr) { ?><input type="hidden" name="letter" value="<?php echo $ltr; ?>" /><?php } ?> <input type="hidden" name="page" value="<?php echo $page; ?>" /> </form> </div> <div class="results"> Showing <?php echo ($from + 1); ?> - <?php echo min($from + $total_on_page, $total); ?> of <?php echo $total; ?> </div> </div> <table align="center" width="100%" border="0" cellspacing="0" cellpadding="5"> <?php while ($row = mysql_fetch_array($result)) { $cc++; ?> <tr class="<?php if (($cc%2) == 0) echo "even"; else echo "odd"; ?>"> <td width="125" align="center" valign="middle"> <?php if ($row['featured'] == 1) { ?><span class="featured" alt="Featured Retailer" title="Featured Retailer"></span><?php } ?> <div id="shadow"><a href="/view_retailer.php?rid=<?php echo $row['retailer_id']; ?>"><img src="<?php if (!stristr($row['image'], 'http')) echo "/img/"; echo $row['image']; ?>" width="<?php echo IMAGE_WIDTH; ?>" height="<?php echo IMAGE_HEIGHT; ?>" alt="<?php echo $row['title']; ?>" title="<?php echo $row['title']; ?>" border="0" class="imgs" /></a></div> </td> <td align="left" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td width="80%" align="left" valign="top"> <a class="retailer_title" href="/view_retailer.php?rid=<?php echo $row['retailer_id']; ?>"><?php echo $row['title']; ?></a> </td> <td nowrap="nowrap" width="20%" align="right" valign="top"> <span class="cashback"><?php echo DisplayCashback($row['cashback']); ?>X Points</span> </td> </tr> <tr> <td colspan="2" valign="middle" align="left"><p class="retailer_description"><?php echo $row['description']; ?> </p></td> </tr> <tr> <td valign="middle" align="left"> <?php if ($row['conditions'] != "") { ?> <div class="cashbackengine_tooltip"> <a class="conditions" href="#">Conditions</a> <span class="tooltip"><?php echo $row['conditions']; ?></span> </div> <?php } ?> <a class="favorites" href="#" onclick="if (confirm('Are you sure you want to add this retailer to your favorites?') )location.href='/myfavorites.php?act=add&rid=<?php echo $row['retailer_id']; ?>'">Add to Favorites</a> </td> <td valign="middle" align="right"> <a class="go2store" href="/go2store.php?id=<?php echo $row['retailer_id']; ?>" target="_blank">Go to Store</a> </td> </tr> </table> </td> </tr> <?php } ?> <tr> <td valign="middle" align="center" colspan="2"> <?php $params = ""; if (isset($cat_id) && $cat_id > 0) { $params = "cat=$cat_id&"; } if (isset($ltr) && $ltr != "") { $params = "letter=$ltr&"; } echo ShowPagination("retailers",$results_per_page,"retailers.php?".$params."column=$rrorder&order=$rorder&","WHERE ".$where); ?> </td> </tr> </table> <?php }else{ ?> <p align="center">There are no stores to list in this category!<br/><br/><a class="goback" href="#" onclick="history.go(-1);return false;">Go Back</a></p> <?php } ?> <?php require_once ("inc/footer.inc.php"); ?> Here is the code from the browser (View Source) <!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> <title>Retailers | Bonus.me</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <link rel="stylesheet" type="text/css" href="/css/style.css" /> <script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="/js/jquery.autocomplete.js"></script> <script type="text/javascript" src="/js/cashbackengine.js"></script> <link rel="shortcut icon" href="/favicon.ico" /> <link rel="icon" type="image/ico" href="/favicon.ico" /> </head> <body> <div id="container"> <div id="header"> <div id="logo"><a href="http://www.bonus.me/"><img src="/images/LogoSiteFinal.png" alt="Bonus.me" title="Bonus.me" border="0" /></a></div> <div id="links"> <a href="/login.php">Log In</a> | <a href="/register.php">Sign Up</a> </div> <div id="searchbox"> <form action="search.php" method="get" id="searchfrm" name="searchfrm"> <input type="text" id="searchtext" name="searchtext" class="search_inputt" value="Search for stores..." onclick="if (this.defaultValue==this.value) this.value=''" onkeydown="this.style.color='#000000'" onblur="if (this.value=='') this.value=this.defaultValue" /> <input type="hidden" name="action" value="search" /> <input type="submit" class="search_button" value="" /> </form> </div> </div> <div id="menu"> <a href="/">Home</a> <a href="/retailers.php">Online Shopping</a> <a href="/instore.php">In Store Shopping</a> <a href="/myaccount.php">My Account</a> <a href="/withdraw.php">My Rewards</a> <a href="/invite.php">Get More</a> <a href="/benny.php">Benny</a> </div> <div id="column_left"> <div class="box"> <div class="top">Member Login</div> <div class="middle"> <form action="login.php" method="post"> Email Address:<br/> <input type="text" class="inputt" name="username" value="" size="22" /> Password:<br/> <input type="password" class="inputt" name="password" value="" size="22" /> <input type="hidden" name="action" value="login" /> <input type="submit" class="butt" style="margin-top: 2px;" name="login" id="login" value="Login" /> <br/><br/><a href="/forgot.php">Forgot your password?</a> <br/><br/>Not a Member? <a href="/register.php">Sign Up!</a> </form> </div> <div class="bottom"> </div> </div> <div class="box"> <div class="top">Shop by Category</div> <div class="middle"> <ul id="categories"> <li><a href="/retailers.php">All Stores</a></li> <ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=41">Art, Music & Photo</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=40">Automotive</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=1">Books & Magazines</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=38">Department & Discount</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=6">Education</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=7">Electronics & Computers</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=2">Fashion & Apparel</a></li></ul><ul style='padding-left:10px;margin:0;'><li><a href="/retailers.php?cat=36">Children's Fashion</a></li></ul><ul style='padding-left:10px;margin:0;'><li><a href="/retailers.php?cat=35">Men's Fashions</a></li></ul><ul style='padding-left:10px;margin:0;'><li><a href="/retailers.php?cat=42">Shoes</a></li></ul><ul style='padding-left:10px;margin:0;'><li><a href="/retailers.php?cat=34">Women's Fashion</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=9">Flowers</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=10">Food & Drink</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=12">Gifts & Party</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=13">Health & Beauty</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=14">Home & Garden</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=16">Jewelry</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=17">Mobile Phones & Accesories</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=19">Office</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=22">Pets</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=39">Recreation & Leisure</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=15">Software</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=23">Sports & Fitness</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=24">Toys & Games</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=37">Travel</a></li></ul> </ul> </div> <div class="bottom"> </div> </div> </div> <div id="column_center"> <h1>Retailers</h1> <p class="category_description"></p> <div id="alphabet"> <ul> <li><a href="/retailers.php">All</a></li> <li><a href="/retailers.php?letter=0-9">0-9</a></li><li><a href="/retailers.php?letter=A">A</a></li><li><a href="/retailers.php?letter=B">B</a></li><li><a href="/retailers.php?letter=C">C</a></li><li><a href="/retailers.php?letter=D">D</a></li><li><a href="/retailers.php?letter=E">E</a></li><li><a href="/retailers.php?letter=F">F</a></li><li><a href="/retailers.php?letter=G">G</a></li><li><a href="/retailers.php?letter=H">H</a></li><li><a href="/retailers.php?letter=I">I</a></li><li><a href="/retailers.php?letter=J">J</a></li><li><a href="/retailers.php?letter=K">K</a></li><li><a href="/retailers.php?letter=L">L</a></li><li><a href="/retailers.php?letter=M">M</a></li><li><a href="/retailers.php?letter=N">N</a></li><li><a href="/retailers.php?letter=O">O</a></li><li><a href="/retailers.php?letter=P">P</a></li><li><a href="/retailers.php?letter=Q">Q</a></li><li><a href="/retailers.php?letter=R">R</a></li><li><a href="/retailers.php?letter=S">S</a></li><li><a href="/retailers.php?letter=T">T</a></li><li><a href="/retailers.php?letter=U">U</a></li><li><a href="/retailers.php?letter=V">V</a></li><li><a href="/retailers.php?letter=W">W</a></li><li><a href="/retailers.php?letter=X">X</a></li><li><a href="/retailers.php?letter=Y">Y</a></li><li class="last"><a href="/retailers.php?letter=Z">Z</a></li> </ul> </div> <div class="browse_top"> <div class="sortby"> <form action="retailers.php" id="form1" name="form1" method="get"> <span>Sort by:</span> <select name="column" id="column" onChange="document.form1.submit()"> <option value="title" >Name</option> <option value="visits" >Popular</option> <option value="added" >Newest</option> <option value="cashback" >Cashback</option> </select> <select name="order" id="order" onChange="document.form1.submit()"> <option value="desc">Descending</option> <option value="asc" >Ascending</option> </select> <input type="hidden" name="page" value="1" /> </form> </div> <div class="results"> Showing 1 - 2 of 2 </div> </div> <table align="center" width="100%" border="0" cellspacing="0" cellpadding="5"> <tr class="odd"> <td width="125" align="center" valign="middle"> <div id="shadow"><a href="/view_retailer.php?rid=13"><img src="<a href="http://click.linksynergy.com/fs-bin/click?id=8jghEyj/xMI&offerid=226353.10000004&subid=0&type=4"><IMG border="0" alt="Fanzz General Banner 120x90" src="http://ad.linksynergy.com/fs-bin/show?id=8jghEyj/xMI&bids=226353.10000004&subid=0&type=4&gri" width="120" height="60" alt="Fanzz.com" title="Fanzz.com" border="0" class="imgs" /></a></div> </td> <td align="left" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td width="80%" align="left" valign="top"> <a class="retailer_title" href="/view_retailer.php?rid=13">Fanzz.com</a> </td> <td nowrap="nowrap" width="20%" align="right" valign="top"> <span class="cashback">7X Points</span> </td> </tr> <tr> <td colspan="2" valign="middle" align="left"><p class="retailer_description">Fanzz.com sells licensed sports apparel and gifts from the NFL, NBA, MLB, NCAA, NHL, MLS, NASCAR and WNBA. We have dozens of top brands on our site including Nike, Adidas, Reebok, New Era, Antigua, Baseline, Fathead, Fanmats, Majestic, Mitchell and Ness, Under Armour, Wilson, Wincraft and many more. </p></td> </tr> <tr> <td valign="middle" align="left"> <a class="favorites" href="#" onclick="if (confirm('Are you sure you want to add this retailer to your favorites?') )location.href='/myfavorites.php?act=add&rid=13'">Add to Favorites</a> </td> <td valign="middle" align="right"> <a class="go2store" href="/go2store.php?id=13" target="_blank">Go to Store</a> </td> </tr> </table> </td> </tr> <tr class="even"> <td width="125" align="center" valign="middle"> <div id="shadow"><a href="/view_retailer.php?rid=14"><img src="http://www.ftjcfx.com/image-5471697-10807939" width="120" height="60" alt="Pets Warehouse" title="Pets Warehouse" border="0" class="imgs" /></a></div> </td> <td align="left" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td width="80%" align="left" valign="top"> <a class="retailer_title" href="/view_retailer.php?rid=14">Pets Warehouse</a> </td> <td nowrap="nowrap" width="20%" align="right" valign="top"> <span class="cashback">9X Points</span> </td> </tr> <tr> <td colspan="2" valign="middle" align="left"><p class="retailer_description">Founded in 1974 Pets Warehouse® provides the broadest selection of pet supplies available anywhere online, add value to your site and benefit your customers with low prices. </p></td> </tr> <tr> <td valign="middle" align="left"> <a class="favorites" href="#" onclick="if (confirm('Are you sure you want to add this retailer to your favorites?') )location.href='/myfavorites.php?act=add&rid=14'">Add to Favorites</a> </td> <td valign="middle" align="right"> <a class="go2store" href="/go2store.php?id=14" target="_blank">Go to Store</a> </td> </tr> </table> </td> </tr> <tr> <td valign="middle" align="center" colspan="2"> </td> </tr> </table> </div> <div id="column_right"> <div class="center"> <p align="center"> <a href="/invite.php"><img src="/images/ReferAFriend.gif" border="0"></a></br> <a href="/invite.php">Refer A Friend<br/>And Get More!</a> </p> </div> </div> <div id="footer"> <a href="/terms.php">Terms & Conditions</a> · <a href="/contact.php">Contact Us</a> · <a href="/help.php">FAQs</a> <p>© December, 2011. Bonus.Me. All rights reserved.</p> </div> </div> </body> </html> $results_per_page = RESULTS_PER_PAGE; $cc = 0; function getCategory($category_id, $description = 0) { if (isset($category_id) && is_numeric($category_id) && $category_id != 0) { $query = "SELECT name, description FROM cashbackengine_categories WHERE category_id='".(int)$category_id."'"; $result = smart_mysql_query($query); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result); if ($description == 1) return $row['description']; else return $row['name']; }else { return "Category not found"; } } else { if ($description != 1) return "Retailers"; } } ////////////////// filter ////////////////////// if (isset($_GET['column']) && $_GET['column'] != "") { switch ($_GET['column']) { case "title": $rrorder = "title"; break; case "added": $rrorder = "added"; break; case "visits": $rrorder = "visits"; break; case "cashback": $rrorder = "cashback"; break; default: $rrorder = "title"; break; } } else { $rrorder = "title"; } if (isset($_GET['order']) && $_GET['order'] != "") { switch ($_GET['order']) { case "asc": $rorder = "asc"; break; case "desc": $rorder = "desc"; break; default: $rorder = "asc"; break; } } else { $rorder = "asc"; } ////////////////////////////////////////////////// if (isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] > 0) { $page = (int)$_GET['page']; } else { $page = 1; } $from = ($page-1)*$results_per_page; $where = ""; if (isset($_GET['cat']) && is_numeric($_GET['cat']) && $_GET['cat'] > 0) { $cat_id = (int)$_GET['cat']; unset($retailers_per_category); $retailers_per_category = array(); $retailers_per_category[] = "111111111111111111111"; $sql_retailers_per_category = smart_mysql_query("SELECT retailer_id FROM cashbackengine_retailer_to_category WHERE category_id='$cat_id'"); while ($row_retailers_per_category = mysql_fetch_array($sql_retailers_per_category)) { $retailers_per_category[] = $row_retailers_per_category['retailer_id']; } $where .= "retailer_id IN (".implode(",",$retailers_per_category).") AND"; } if (isset($_GET['letter']) && in_array($_GET['letter'], $alphabet)) { $ltr = mysql_real_escape_string(getGetParameter('letter')); if ($ltr == "0-9") { $where .= " title REGEXP '^[0-9]' AND"; }else{ $ltr = substr($ltr, 0, 1); $where .= " UPPER(title) LIKE '$ltr%' AND"; } } $where .= " status='active'"; if ($rrorder == "cashback") $query = "SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY ABS(cashback) $rorder LIMIT $from, $results_per_page"; else $query = "SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY $rrorder $rorder LIMIT $from, $results_per_page"; $total_result = smart_mysql_query("SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY title ASC"); $total = mysql_num_rows($total_result); $result = smart_mysql_query($query); $total_on_page = mysql_num_rows($result); /////////////// Page config /////////////// $PAGE_TITLE = getCategory($_GET['cat']); require_once ("inc/header.inc.php"); ?> <h1><?php echo getCategory($_GET['cat']); ?></h1> <?php if ($total > 0) { ?> <p class="category_description"><?php echo getCategory($_GET['cat'], 1); ?></p> <div id="alphabet"> <ul> <li><a href="/retailers.php">All</a></li> <?php $numLetters = count($alphabet); $i = 0; foreach ($alphabet as $letter) { $i++; if ($i == $numLetters) $lilast = ' class="last"'; else $lilast = ''; if (isset($cat_id) && is_numeric($cat_id)) echo "<li".$lilast."><a href=\"/retailers.php?cat=$cat_id&letter=$letter\">$letter</a></li>"; else echo "<li".$lilast."><a href=\"/retailers.php?letter=$letter\">$letter</a></li>"; } ?> </ul> </div> <div class="browse_top"> <div class="sortby"> <form action="retailers.php" id="form1" name="form1" method="get"> <span>Sort by:</span> <select name="column" id="column" onChange="document.form1.submit()"> <option value="title" <?php if ($_GET['column'] == "title") echo "selected"; ?>>Name</option> <option value="visits" <?php if ($_GET['column'] == "visits") echo "selected"; ?>>Popular</option> <option value="added" <?php if ($_GET['column'] == "added") echo "selected"; ?>>Newest</option> <option value="cashback" <?php if ($_GET['column'] == "cashback") echo "selected"; ?>>Cashback</option> </select> <select name="order" id="order" onChange="document.form1.submit()"> <option value="desc"<?php if ($_GET['order'] == "desc") echo "selected"; ?>>Descending</option> <option value="asc" <?php if ($_GET['order'] == "asc") echo "selected"; ?>>Ascending</option> </select> <?php if ($cat_id) { ?><input type="hidden" name="cat" value="<?php echo $cat_id; ?>" /><?php } ?> <?php if ($ltr) { ?><input type="hidden" name="letter" value="<?php echo $ltr; ?>" /><?php } ?> <input type="hidden" name="page" value="<?php echo $page; ?>" /> </form> </div> <div class="results"> Showing <?php echo ($from + 1); ?> - <?php echo min($from + $total_on_page, $total); ?> of <?php echo $total; ?> </div> </div> <table align="center" width="100%" border="0" cellspacing="0" cellpadding="5"> <?php while ($row = mysql_fetch_array($result)) { $cc++; ?> <tr class="<?php if (($cc%2) == 0) echo "even"; else echo "odd"; ?>"> <td width="125" align="center" valign="middle"> <?php if ($row['featured'] == 1) { ?><span class="featured" alt="Featured Retailer" title="Featured Retailer"></span><?php } ?> <div id="shadow"><a href="/view_retailer.php?rid=<?php echo $row['retailer_id']; ?>"><img src="<?php if (!stristr($row['image'], 'http')) echo "/img/"; echo $row['image']; ?>" width="<?php echo IMAGE_WIDTH; ?>" height="<?php echo IMAGE_HEIGHT; ?>" alt="<?php echo $row['title']; ?>" title="<?php echo $row['title']; ?>" border="0" class="imgs" /></a></div> </td> <td align="left" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td width="80%" align="left" valign="top"> <a class="retailer_title" href="/view_retailer.php?rid=<?php echo $row['retailer_id']; ?>"><?php echo $row['title']; ?></a> </td> <td nowrap="nowrap" width="20%" align="right" valign="top"> <span class="cashback"><?php echo DisplayCashback($row['cashback']); ?>X Points</span> </td> </tr> <tr> <td colspan="2" valign="middle" align="left"><p class="retailer_description"><?php echo $row['description']; ?> </p></td> </tr> <tr> <td valign="middle" align="left"> <?php if ($row['conditions'] != "") { ?> <div class="cashbackengine_tooltip"> <a class="conditions" href="#">Conditions</a> <span class="tooltip"><?php echo $row['conditions']; ?></span> </div> <?php } ?> <a class="favorites" href="#" onclick="if (confirm('Are you sure you want to add this retailer to your favorites?') )location.href='/myfavorites.php?act=add&rid=<?php echo $row['retailer_id']; ?>'">Add to Favorites</a> </td> <td valign="middle" align="right"> <a class="go2store" href="/go2store.php?id=<?php echo $row['retailer_id']; ?>" target="_blank">Go to Store</a> </td> </tr> </table> </td> </tr> <?php } ?> <tr> <td valign="middle" align="center" colspan="2"> <?php $params = ""; if (isset($cat_id) && $cat_id > 0) { $params = "cat=$cat_id&"; } if (isset($ltr) && $ltr != "") { $params = "letter=$ltr&"; } &nbs Hello, freaks. I need a little help with the best way to go about this. I have a field in mysql that contains a comma separated string of values. What I need to do is get those values out of the db and list them into editable text fields so the user can update the values in a html form. So far this is my code, I left out all the in betweens - validation, results, etc - for this post...but its there . SELECT servs FROM services WHERE id = $a_id $services = $row['servs']; $srvs = explode(',', $services); Then for the form: <?php foreach ($srvs as $service) { ?> <input type="text" name="servs[]" value="<?php echo $service ?>" /> <?php } ?> This gives me a text field for each value of servs, great! But the problem is, the user can enter up to 15 servs. Some currently have less than that saved in the db. I want to give them the ability to 1. edit any of the current servs value and 2. add more values if they have less than 15. My question is, how do I echo out 15 editable text fields for servs[] no matter the number of values they currently have? And when I go to implode the values, will blank text fields screw everything up? I can't find anything in the forums that relate to this. I believe it probably will involve $i, but I am not too familiar with counting in php yet, so I could really use some help. Thanks! Oh - and I am not stuck on using text fields, but I couldn't figure how to make this work using a select list or checkboxes. Any suggestions either way would help. hi again, after I clicked a particular data to edit, it will bring me to a html which i created, UpdateRecordForm.html In there, how do i retrieve the data from database so it will show the data in the textbox that i can edit it. Code: [Select] <!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>adding a new data record</title> </head> <body> <form id="form1" name="form1" method="post" action="processUpdateRecord.php"> <p> <label>Student Number: <input name="StudentNumber" type="text" id="StudentNumber" size="10" /> </label> </p> <p> <label>First Name: <input name="FirstName" type="text" id="FirstName" size="20" /> </label> </p> <p> <label>Last Name: <input name="LastName" type="text" id="LastName" size="20" /> </label> </p> <p> <label>Email Address: <input name="EmailAddr" type="text" id="EmailAddr" size="50" /> </label> </p> <p> <label>Telephone: <input name="PhoneNumber" type="text" id="PhoneNumber" size="20" /> </label> </p> <p> <input type="submit" name="submit" id="submit" value="Update Record" /> </p> </form> </body> </html> hi there, the code below is suppose to display something like the attachement "code2" but instead it displays something like attachement "code1" please assist in find what is wrong with my echo lines.
<?php $counter = 2; $sqlq="select * from state WHERE status = 0 "; $categorysqlq = mysql_query($sqlq); $varq = mysql_num_rows($categorysqlq); while($catfetchq = mysql_fetch_array($categorysqlq)) { $cnty = $catfetchq[0]; $sqllq="select * from vehicle WHERE country = '$cnty' "; $categorysqllq = mysql_query($sqllq); $numsql = "select * from branchaddr WHERE state = '$cnty' "; $numquery = mysql_query($numsql); $varqa = mysql_num_rows($numquery); $cntyfetchq= mysql_fetch_array($numquery); if($varq != 0){ if($counter == 2){ echo "<tr><td><a href=\"transport2.php?id=".$cntyfetchq['state'].">".$catfetchq[1]."(<span style=\"color:red\">".$varqa."</span>)</a></td>"; $counter--; } else{ echo "<td><a href=\"transport2.php?id=".$cntyfetchq['state'].">".$catfetchq[1]."(<span style=\"color:red\">".$varqa."</span>)</a></td></tr>"; $counter = 2; } } } ?>Attached Files code1.png 12.65KB 0 downloads code2.png 25.34KB 0 downloads Code: [Select] <?php function checking_out() { $conn = db_connect(); $nickname=$_SESSION['valid_user']; $query="select sum(price) from preorders where name='".$nickname."'"; $result = $conn->query($query); if ($result) { echo '<h1>'.$result.'</h1>'; } } ?> This is not working, there is no result in the browser, any idea ? Hello, I've never really used the update command before for mysql and I'm attempting to use it and struggling a little bit. I'm trying to use mysqli prepared statements.. here's the code that I have thus far: if($query = $database->connection->prepare("UPDATE videos SET comments=?, views=?, uploader=? WHERE title = ?")) { $query->bind_param('iiss', $comments, $views, $uploader, $title); $query->execute(); $result = $query->affected_rows; $query->close(); } For some reason I cannot get this working. I have created a modification page for the administrators to be able change any of the values and wanting to update the database to reflect the changes. When using the MySQL UPDATE command do all of the values have to get changed or modified, or am I able to pass back some of the same values? Like with the above code.. if I only wanted to update the views, would I still be able to just pass in the same values for comments and uploader and it would just replace the values? Hi all,
I am not sure why my header is not displaying the header image after using the CSS
I have a png file that repeats horizotally.
Please help
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Wikigets The online store</title> <style type="text/css"> body { margin:0 px;} #pageTop { background: url(style/headerline1.png); height:110 px; } </style> </head> <body> <div id="pageTop"> </div> <div id="pageMiddle"></div> <div id="pageBottom"></div> </body> </html> headerline1.png 2.82KB 0 downloads headerline1.png 2.82KB 0 downloads I get the unable to jump to row zero mysql error. Code: [Select] function is_admin($uid, $cid) { $uid = (int)$uid; $cid = (int)$cid; $sql = "SELECT `users`.`id` AS `uid`, `companies`.`companyid` AS `cid`, `companies`.`adminid` AS `aid` FROM `companies` LEFT JOIN `users` ON `users`.`id` = companies.adminid WHERE `users`.`id` = {$uid} AND `companies`.`companyid` = {$cid}"; $user = mysql_query($sql); return (mysql_result($user, 0) == '1') ? true : false; } Hi, I've a simple code which uses a class from here. When I execute it, I get this error QuoteFatal error: Uncaught Error: Class 'phpMQTT' not found in C:\Apache24\htdocs\mqtt\test.php:10 Stack trace: #0 {main} thrown in C:\Apache24\htdocs\mqtt\test.php on line 10 and I cannot understand why my code doesn't see the class. Both files, the class.php and test.php, are in the same folder. Any help is appreciated.
TIA <?php require("phpMQTT.php"); $server = "192.168.0.250"; // change if necessary $port = 1883; // change if necessary $username = ""; // set your username $password = ""; // set your password $client_id = "phpMQTT-publisher"; // make sure this is unique for connecting to sever - you could use uniqid() $mqtt = new phpMQTT($server, $port, $client_id); if ($mqtt->connect(true, NULL, $username, $password)) { echo 'hereeeee'; $mqtt->publish("room/lamp", "on" . date("r"), 0); $mqtt->close(); } else { echo "Time out!\n"; } ?>
Hello....I am using ajax,jquery with php to insert data in db.....but the script is not working. form.html: Code: [Select] <!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>Untitled Document</title> <style type="text/css"> label{ display:block; } </style> <script type="text/javascript" src="jquery-1.5.min.js"> </script> <script type="text/javascript"> $(function() { $('#submit').click(function(){ $('#container').append('<img src="ajax-loader.gif" id="loading" alt="image" />'); var name=$('#name').val(); var email=$('#email').val(); var d=$('#d').val(); var m=$('#m').val(); var y=$('#y').val(); var add=$('#add').val(); var phone=$('#phone').val(); $.ajax({ url: 'process.php', type: 'POST', data: 'name=' + name + '&email=' + email + '&d=' + d + '&m=' + m + '&y=' + y + '&add=' + add + '&phone=' + phone, success: function(result){ $('#response').remove(); $('#container').append('<p id="response">' + result + '</p>'); $('#loading').fadeOut(500,function(){ $(this).remove(); }); } }); return false; }); }); </script> </head> <body> <h2>User Registeration</h2> <form action="process.php" method="POST"> <div id="container"> Name:<br> <input type="text" name="name" id="name" /><br> Email:<br> <input type="text" name="email" id="email" /><br> Date Of Birth:<br> <input type="text" id="d" name="d" size="2" /> <input type="text" id="m" name="m" size="2" /> <input type="text" id="y" name="y" size="4" /><br> Address:<br> <input type="text" id="add" name="add" /><br> Phone:<br> <input type="text" id="phone" name="phone" /><br> <input type="submit" name="submit" id="submit" value="GO!" /> </div> </form> </body> </html> process.php My db id named "jquery" and table is "tab" Code: [Select] <?php $conns=mysql_connect("localhost","root",""); if(!$conns) echo "error in connection"; mysql_select_db("jquery", $conns); $name=$_POST['name']; $email=$_POST['email']; $m=$_POST['m']; $d=$_POST['d']; $y=$_POST['y']; $add=$_POST['add']; $phone=$_POST['phone']; echo $name,"<br>"; echo $email,"<br>"; echo $m, "<br>"; echo $d,"<br>"; echo $y,"<br>"; echo $add, "<br>"; echo $phone,"<br>"; $query="INSERT INTO tab (name,email,d,m,y,add,phone) VALUES ('$name',$email','$d','$m','$y','$add','$phone')"; if(!mysql_query($query,$conns)) echo "Error"; else echo "DATA inserted"; ?> The output shown is: pulkit pulkit@gmail.com 1 26 1991 lucknow 987576787 Error For some values i entered. Hello, I'm working with Zend Framework on Linux, and I'm trying to generate a CAPTCHA using Zend_Form_Element_Captcha. Whenever the CAPTCHA page loads I get this error: [12-Jan-2011 18:14:54] PHP Warning: imagepng() [<a href='function.imagepng'>function.imagepng</a>]: Unable to open '/var/www/square/application/../public/captcha/ebf44d292149b3ebda05571c54c463a8.png' for writing: Permission denied in /usr/local/zend/share/ZendFramework/library/Zend/Captcha/Image.php on line 563 Here's my code for generating the CAPTCHA: // create captcha $captcha = new Zend_Form_Element_Captcha('captcha', array( 'captcha' => array( 'captcha' => 'Image', 'wordLen' => 6, 'timeout' => 300, 'width' => 300, 'height' => 100, 'imgUrl' => '/captcha', 'imgDir' => APPLICATION_PATH . '/../public/captcha', 'font' => APPLICATION_PATH . '/../public/fonts/LiberationSansRegular.ttf', ) )); I've checked permissions, and all directories mentioned above are accessible to root. Has anyone had a similar problem or have an idea how I can fix this? Kind Regards, Mike Hi I have got a database table for logging in. One user will not log in even though the data is valid Code: [Select] $user = ValidateKey($_SESSION["Name"] , $_SESSION["PWD1"] , $_SESSION["PWD2"]); // User if($Error == 1 || $user == 0 || $user == -1) { // header('Location: index.php'); echo $Error . " , " . $user; // result is 0, caf9eba77c55ab5ae81a01c25d1987d3 exit; } All other user are OK! Strange Desmond. my firefox won't open up .tpl format im running apache...how can i view that format on my apache please? In the given code below I am getting this error Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\samples\getcustomers.php on line 20 WHY? Code: [Select] <?php $value = $_GET["q"]; $con = mysql_connect('localhost', 'root', ''); //db_connect(); if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db("ajaxDb",$con); $sql = "SELECT * FROM 'cutomers' WHERE Name = '".$value."'"; // echo $sql; $result = mysql_query($sql); echo "<table border='1'> <tr> <th>Name</th> <th>Address</th> <th>Country</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['Name'] . "</td>"; echo "<td>" . $row['Address'] . "</td>"; echo "<td>" . $row['Country'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> Unable to execute query (SELECT * FROM lb-players) in the database : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-players' at line 1 I don't know why i am getting this error. All i can think of that is taking away lb from "lb-players" when you add a " - "? Code: [Select] [m]<?php $conn = mysql_connect("23.23.23.23", "unknown", "itsAsecertxD");//ignore this xD if (!$conn) { echo "Unable to connect to the database : " . mysql_error(); exit; } if (!mysql_select_db("minecraft-rc")) { echo "Unable to select database mydbname : " . mysql_error(); exit; } $sql = 'SELECT * FROM lb-players'; $result = mysql_query($sql); if (!$result) { echo "Unable to execute query ($sql) in the database : " . mysql_error(); exit; } if (mysql_num_rows($result) == 0) { echo "No rows found, nothing to display."; exit; } while ($row = mysql_fetch_assoc($result)) { echo $row["playername"]; } mysql_free_result($result); ?>[/m] tell me if i posted this in the wrong place its been forever since i last been on this site :$ Hallo everyone... here is my following code. i am fetching the picture from the file but unable to fetch it.
kindly help me. error in bold underline...
Thanks
<!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>Untitled Document</title> </head> <body> <?php session_start(); $uid=''; include("connection.php"); $query=mysql_query("SELECT * FROM users WHERE uid='".$_GET['uid']."'"); $row=mysql_fetch_array($query); $image=$row['images_path']; ?> <form action="edit.php" method="post"> <table border="1px" align="center" width="85%"> <tr> <td colspan="3"><?php include'header.php' ?></td> </tr> <input type="hidden" name="uid" value="<?=$_GET['uid'];?>" /> <tr> <td colspan="3">Welcome <?php echo $_GET['uid']; ?> </td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">User Name</td> <td width="63%"> <input type="text" name="uname" value="<?php echo $row['uname']?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">User Email</td> <td width="63%"> <input type="text" name="email" value="<?php echo $row['email'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Mobile</td> <td width="63%"> <input type="text" name="mob" value="<?php echo $row['mob'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Type</td> <td width="63%"> <input type="text" name="type" value="<?php echo $row['type'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Status</td> <td width="63%"> <input type="text"name="status" value="<?php echo $row['status'];?>" /></td> </tr> <tr height="30px;"> <td width="37%" style="padding-left:250PX;">Picture</td> <td><?php echo "<img border=\"0\" src=\"".$row['images_path']."\" width=\"102\" alt=\"your name\" height=\"91\">"; ?></td> </tr> </tr> <tr height="50px;"> <td colspan="3" style="padding-left:350px;"><input type="submit" name="submit" /> <input type="reset" value="Clear" /></td> </tr> <tr> <td colspan="3"><?php include'footer.php' ?></td> </tr> </table> <div align="left"><a href="home_users.php">Home</a></div> </form> </body> </html> Hello. I am coding a remember me feature. Everything is working, except i am being logged in using cookies even when i want to use a session. To login using a cookie i must select the checkbox, for sessions i must leave it blank. Here is my code, if someone could spot a mistake i would be really grateful. Login page Code: [Select] <?php ob_start(); // starting session... session_start(); // requiring connection... require("functions.php"); // assigning variables... $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $submit = mysql_real_escape_string($_POST['submit']); $rememberme = $_POST['rememberme']; // querying database... $query = mysql_query("SELECT * FROM users WHERE username = '$username'"); $numrows = mysql_num_rows($query); if ($numrows != 0) { while ($row = mysql_fetch_assoc($query)) { $db_username = $row['username']; $db_password = $row['password']; } } // verifying login details... if ($submit) { if (!empty($username) && !empty($password)) { if ($username == $db_username && $password == $db_password) { if ($rememberme = "on") { setcookie("username", $username, time() + 7200); header('Location: tablets.php'); } else { $_SESSION['username'] = $db_username; $url = $_SESSION['origin'] ? $_SESSION['origin'] : "main.php"; unset($_SESSION['origin']); header('Location: ' . $url); exit; } } else { echo "Incorrect login details"; } } else { echo "You must type in username and password"; } } ob_end_flush(); ?> Login form Code: [Select] <?php session_start(); require("connect.php"); if (isset($_SESSION['username']) || isset($_COOKIE['username'])) { header('Location: main.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" xml:lang="en" lang="en"> <head> <title>Login</title> <link rel="stylesheet" type="text/css" href="form.css" /> </head> <body> <form method="post" action="login.php"> <div class="box"> <h1>Login</h1> <label> <span>Username</span> <input type="text" class="input_text" name="username" id="name" /> </label> <label> <span>Password</span> <input type="password" class="input_text" name="password" id="password" /> </label> <input type="checkbox" name="rememberme" /> <label> <input type="submit" class="button" value="Login" name="submit" /> </label> </div> </form> </body> </html> I'm suddenly having trouble using my connection to my MySQL database... (yes it was working but now...) I have the Connection created in an include file and stored in variable $DB, in the main file that includes the file containing the$DB there are other includes for classes. These classes are SUPPOSED to use $DB to connect to and SELECT/UPDATE/INSERT, but for a reason I cant figure out they suddenly stopped seeing $DB. it keeps saying its an undefined variable. If you need to see code I can post... I have written my index.php script where after verifying the password the script displays the user's name. But the user name is not displayed by it. Here is my script Hi All. New at this, form is working perfect, then added recapthca, now it only handles recaptcha and not the form. not sure where the error is
|