Jump to content

Help!php

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Posts posted by Help!php

  1. There is a reset button on my page and it works fine but now I want to let the  user reset the information and redirect the page to homepage. So far this is how the code looks. its in javascript.

     

    function formReset()
    {
    var fields = document.getElementsByTagName( "input" );	
    
    for ( i = 0; i < fields.length; i++ )
    {
    	if ( fields[ i ].type == "checkbox" )
    		fields[ i ].checked = false;
    }
    
    document.getElementById( 'rrpmin' ).selectedIndex = 0;
    document.getElementById( 'rrpmax' ).selectedIndex = 0;
    
    eraseCookie( _cookieName );
    
    fieldClick();
    
    
    }

  2. Sorry..

     

    Well I am trying to read a sitemap and get the URL and the page is not displaying. But I managed to change one of the name to true and its printing what I echoed but no result.

     

    $_ECHO = TRUE;

     

    This was false before.

     

    Now that I have changed it to true.. It prints START: Fetching site map.. then it goes straight to NO URL FOUND ON THIS PAGE. its skipping the middle bits. any help???

     

     

     

    $numSitemapPages = 1;	
    $html = new simple_html_dom();
    
    if($_ECHO) echo "START: Fetching site map...<br />";
    
    for( $i = 0; $i < $numSitemapPages; $i++ )
    {
    	if($_ECHO) echo "Page $i<br />";
    
    	$fileContents = file_get_contents( "http://www.website.co.uk/SiteMap" . $i . ".aspx" );
    	$html->load( $fileContents );
    
    	$hrefs = $html->find( "a(style=color: Blue; text-decoration: underline;)" );
    
    	if ( isset( $hrefs[ 0 ] ) )
    	{
    		foreach( $hrefs as $href )
    		{						
    			$url = "http://www.website.co.uk/" . $href->href;
    			$qry = "INSERT INTO SITEMAP (url) VALUES( '$url' )";
    
    			mysql_query( $qry, $con );
    
    			if($_ECHO) echo "MYSQL: Added $href->href to DB<br />";
    		}
    	}
    	else
    		if($_ECHO) echo "NO URLS FOUND ON THIS PAGE!<br />";
    }

  3. I am trying to get content from a website but it doesnt seem to be working. It creates a table and the columns needed but after that the code is not reading.

     

    <div style="padding-top: 10px; float: left; clear: both;">

    <a style="color: Blue; text-decoration: underline;" href="index.aspx"> Index </a>

    </div>

     

    This is the part thats on the site and I just want to get the href bit "index.aspx".

     

    for( $i = 0; $i < $numSitemapPages; $i++ )
    {
    	if($_ECHO) echo "Page $i<br />";
    
    	$fileContents = file_get_contents( "http://www.website.co.uk/SiteMap" . $i . ".aspx" );
    	$html->load( $fileContents );
    
    	$hrefs = $html->find( "<a[style=color: Blue; text-decoration: underline;]" );
    
    
    	if ( isset( $hrefs[ 0 ] ) )
    	{
    		foreach( $hrefs as $href )
    		{						
    			$url = "http://www.website.co.uk/" . $href->href;
    			$qry = "INSERT INTO SITEMAPP (url) VALUES( '$url' )";
    			//echo $url;
    			mysql_query( $qry, $con );
    
    			if($_ECHO) echo "MYSQL: Added $href->href to DB<br />";
    		}
    	}
    	else
    		if($_ECHO) echo "NO URLS FOUND ON THIS PAGE!<br />";
    }

     

    This is the for loop statement which should work. But not working. any idea why???

  4. Thank you for helping.

     

    I have tired your code and it works for phpfreak.com/sitemap but not for the website I want to try.

     

    I dont need the title I just want the URL for these titles.

     

    Lets ssay for example http://www.php.net/sitemap.php

     

    You know how they have different link eg. Homepage, News Archives ect. I want each of the URL to be printed then I can import that to database.

    So for homepage it would be > http://www.php.net/index.php

     

  5. First of all I have no idea  how to do this. But I know it can be done. A little help would be alot for me.

     

    Thank you in advance.

     

    So I want to go through a sitemap and visit each of the link on the sitemap and save the URL on to a database.

     

    Example:

     

    HP 5550N A3 Colour Laser Printer

     

     

    Konica Minolta PagePro 1350W A4 Mono Laser Printer

     

     

    HP 9050dn A3 Mono Laser Printer

     

     

    HP 5550DTN A3 Colour Laser Printer

     

     

    HP 5550HDN A3 Colour Laser Printer

     

     

    HP 5550DN A3 Colour Laser Printer

     

    Lets say this was on the sitemap and it just continues with other product like this. I want to write a code where it will go to the first link and saves the product URL on to the database and continues to do the same until the last link. On my example it would be HP 5550DN A3 Colour Laser Printer.

     

    Any help??? Any ideas??

     

    I am not asking someone to write the code for me.. Just need help and good direction  :) 

     

  6. I want to replace everything that is blank field to "Welcome to the page"

     

    Eg.

     

    Productid                      Inbox

    0012                            something is in here

    0011

    0010                              something is in here

    0015

     

    so for 0011 and 0015 I want to put " Welcome to the page" but there are many other productid with empty inbox.

  7. Thank you so much for everyone answer.

     

    I am a her. :)...

     

    I apologies for my confusion.

     

    Without the strip tag.. it shows

     

    <div id="ctl00_placeholderMain_pnlInTheBox" class="tabitem">                      <p>                      HP LaserJet 9050 printer<br/> Power cord<br/> Parallel cable<br/> HP LaserJet Q8543X Smart print cartridge<br/> Printer documentation<br/> Printer software CD<br/> Control panel overlay<br/> Face-up output bin<br/> Two 500-sheet input tray<br/> 100 Sheet Multipurpose Tray<br/> HP JetDirect Fast</p>                </div>

     

    All i wanted to do is... get rid of

     

    ]<div id="ctl00_placeholderMain_pnlInTheBox" class="tabitem">                      <p> 

     

    and

     

    </p>                </div>[/

     

    Thats all.

  8. I have a paragrpah which has tags that needs to be stripped off.

     

    so the paragraph looks like

     

    <div id="ctl00_placeholderMain_pnlInTheBox" class="tabitem">                    <p>                      HP LaserJet 9050 printer<br/> Power cord<br/> Parallel cable<br/> HP LaserJet Q8543X Smart print cartridge<br/> Printer documentation<br/> Printer software CD<br/> Control panel overlay<br/> Face-up output bin<br/> Two 500-sheet input tray<br/> 100 Sheet Multipurpose Tray<br/> HP JetDirect Fast</p>                </div>

     

    I want it to look like

     

    HP LaserJet 9050 printer

    Power cord

    Parallel cable

    HP LaserJet Q8543X Smart print cartridge

    Printer documentation

    Printer software CD

    Control panel overlay

    Face-up output bin

    Two 500-sheet input tray

    100 Sheet Multipurpose Tray

    HP JetDirect Fast

     

    How would I go on about doing this..

     

    currently i use

     

    $inbox = $html->find( "#ctl00_placeholderMain_pnlInTheBox" );
    
    		if ( isset( $inbox[ 0 ] ) )
    		{
    
    
    
    			$box =( $inbox[0] );
    
    			$box = strpos($box, ';') !== FALSE ? substr( $box, strpos( $box, ";" ) + 1 ) : $box;  
    
    
    		}
    		else
    		{
    			$box = "0";
    		}

  9. Yep I just found it.

     

    I am using

    box = strip_tags( $inbox[0] );

    to strip everything so the <br> get stripped.

     

    I have removed that but now i am getting something like

     

    <div id="ctl00_placeholderMain_pnlInTheBox" class="tabitem">  	                  <p>                      HP LaserJet 9050 printer<br/> Power cord<br/> Parallel cable<br/> HP LaserJet Q8543X Smart print cartridge<br/> Printer documentation<br/> Printer software CD<br/> Control panel overlay<br/> Face-up output bin<br/> Two 500-sheet input tray<br/> 100 Sheet Multipurpose Tray<br/> HP JetDirect Fast</p>                </div>

     

    I dont want

    ]<div id="ctl00_placeholderMain_pnlInTheBox" class="tabitem">                    <p>
    and
    </p>                </div>[/code]

     

    What would I need to do in order to remove the div

  10. $inbox = $html->find( "#ctl00_placeholderMain_pnlInTheBox" );
    
    		if ( isset( $inbox[ 0 ] ) )
    		{
    
    			// Tidy it up - remove commas and weird Word chars
    			$box = strip_tags( $inbox[0] );
    			//$box = substr( $box, strpos( $box, ";" ) + 1 ); 
    			$box = strpos($box, ';') !== FALSE ? substr( $box, strpos( $box, ";" ) + 1 ) : $box;  
    
    
    			$box = str_replace("</ br>", ".", $box ); // this is where I am trying to replace the <br> with a full stop
    
    		}
    		else
    		{
    			$box = "0";
    		}
    

     

    I am not striping <br>. when I try to get it from the website. All the information is in one paragraph..

  11. I am trying to get information from a website and these information are seperated by <br>

     

    Samsung ML-3310ND

    <br>

    AC Cable (UK)

    <br>

    CD/DVD (including Software/ Utilities/ Drivers and User Manuals)

    <br>

    Setup Guide

    <br>

    Black Toner Cartridge 2000 pages

     

    When I import this to the database it becomes

     

    Samsung ML-3310NDAC Cable (UK)CD/DVD (including Software/ Utilities/ Drivers and User Manuals)

    Setup GuideBlack Toner Cartridge 2000 pages

     

    How would I get it exactly how it looks. so it doesnt print in one paragraph.

     

    this is the code I am using..

     

    $inbox = $html->find( "#ctl00_placeholderMain_pnlInTheBox" );
    
    		if ( isset( $inbox[ 0 ] ) )
    		{
    
    			// Tidy it up - remove commas and weird Word chars
    			$box = strip_tags( $inbox[0] );
    			//$box = substr( $box, strpos( $box, ";" ) + 1 ); 
    			$box = strpos($box, ';') !== FALSE ? substr( $box, strpos( $box, ";" ) + 1 ) : $box;  
    			$box = str_replace("", "<br>", $box );
    
    		}
    		else
    		{
    			$box = "0";
    		}

  12. I have a checkbox with A3 and A4 and other options. All the other one works besides A3 and A4. Because of the query or whatever. I dont know.

     

    I have attched an image of the checkbox. A3 and A4 wont work and this checkbox is created using javascript and its not my code. Some intern did it and I have to work on it and I am not sure.

    post-131124-13482403317015_thumb.png

  13. I have conducted a query which should work but its not. Is there any error with this query.

     

    if ( isset( $_GET[ 'rrpmin' ] ) && isset( $_GET[ 'rrpmax' ] ) )
    {		
    	foreach( $_GET as $k => $v )
    	{
    		switch( strtolower( $k ) )
    		{
    			case "ethernet":
    			case "usb":
    			case "parallel":
    				if ( $v == "1" )				
    					$qryParams .= "not isnull(`printers`.`{$k}`) AND length(`printers`.`{$k}`) > 0 AND `printers`.`{$k}` NOT LIKE 'no' AND ";
    			break;
    
    			case "duplex":
    				if ( $v == "1" )
    					$qryParams .= "not isnull(`printers`.`duplex`) AND length(`printers`.`duplex`) > 0 AND `printers`.`duplex` NOT LIKE 'no' AND `printers`.`duplex` NOT LIKE '%manual%' AND ";
    			break;
    
    			case "A3":
    			case "A4":
    				if ( $v == "1" )				
    					$qryParams .= "format LIKE '%{$k}%' AND ";
    
    			break;
    			case "windows":
    			case "mac":
    				if ( $v == "1" )				
    					$qryParams .= "platform LIKE '%{$k}%' AND ";
    
    			break;
    
    			case "format":
    			case "category":
    				$qryParams .= "{$k}='{$v}' AND ";
    			break;
    
    			case "wireless":
    			if ( $v == "1" )				
    				$qryParams .= "name like '%w' AND ";
    			break;
    		}
    	}

     

    The whole thing worked until I added

     

    case "A3":
    			case "A4":
    				if ( $v == "1" )				
    					$qryParams .= "format LIKE '%{$k}%' AND ";
    
    			break;

     

    This case is not working and I was wondering why?

  14. This is the line for a3.. but its the same php file.

     

    <?php $srchboxFormat = "A3"; $srchboxCategory = "Colour Laser"; $srchBoxHeading = "A3 Colour Laser Printer Finder"; require_once('includes/srchbox.php'); ?>

     

    whats inside srchbox.php is

     

    echo <<<_END
    
    
    <div class='srchbox'>
    <div class='srchboxbordertop'> </div>	
    
    	<p class='srchboxheading'>{$srchBoxHeading}</p>
    
    	<p class='srchboxhidden' id='format' name='format'>{$srchboxFormat}</p>
    	<p class='srchboxhidden' id='category' name='category'>{$srchboxCategory}</p>
    	<p class='srchboxhidden' id='pagenum' name='pagenum'>1</p>
    
    	<div style='margin-left: 10px;' class='srchboxcolumn'>
    
    			<p class='srchboxcoltitle'>Connectivity</p>
    
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='usb' />USB</p>
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='ethernet' />Network</p>
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='wireless' />Wireless</p>
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='parallel' />Parallel</p>
    
    	</div>
    
    	<div class='srchboxcolumn'>
    
    			<p class='srchboxcoltitle'>Double-sided print</p>
    
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='duplex' />Automatic</p>
    
    			<p class='srchboxcoltitle'>Size</p>
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='A3' />A3</p>
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='A4' />A4</p>
    
    	</div>
    
    	<div class='srchboxcolumn'>
    
    			<p class='srchboxcoltitle'>Compatibility</p>
    
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='windows' />Windows</p>
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='mac' />Mac</p>
    
    			<p style='margin-top:38px' class='floatright'><img class='srchboxbtn' src='/images/reset.jpg' onclick='formReset()'/></p>
    
    			<div class='clearfloats'></div>
    	</div>
    
    	<div class='srchboxcolumn'>
    
    	<div class="floatleft" style="width: 100%; height: 100px; margin: 0px;">
    				<p class='srchboxcoltitle'>Price range</p>
    
    				<div class='floatleft'>Min price(£)</div>
    				<div class="floatright">
    					<select class="floatright" onchange=fieldClick() type='option' id='rrpmin' name='rrpmin'>						
    						<option>0</option>
    						<option>100</option>
    						<option>200</option>
    						<option>300</option>
    						<option>400</option>
    						<option>500</option>
    						<option>600</option>
    						<option>700</option>
    						<option>800</option>
    						<option>900</option>
    						<option>1000</option>
    						<option>1500</option>
    						<option>2000</option>
    						<option>3000</option>
    						<option>4000</option>
    						<option>5000</option>
    						<option>10000</option>
    					</select>
    				</div>	
    
    				<div class='clearfloats'></div>
    
    				<p></p>
    
    				<div class='floatleft'>Max price(£)</div>
    				<div class="floatright">
    					<select onchange=fieldClick() type='option' id='rrpmax' name='rrpmax' />
    						<option>0</option>
    						<option>100</option>
    						<option>200</option>
    						<option>300</option>
    						<option>400</option>
    						<option>500</option>
    						<option>600</option>
    						<option>700</option>
    						<option>800</option>
    						<option>900</option>
    						<option>1000</option>
    						<option>1500</option>
    						<option>2000</option>
    						<option>3000</option>
    						<option>4000</option>
    						<option>5000</option>
    						<option>10000</option>
    					</select>
    				</div>
    
    	</div>
    
    		<div class='clearfloats'></div>
    		<div id='srchboxmatch' class='srchboxmatch'>searching...</div>
    		<p style="margin-top: 6px;" class='floatright'><img class='srchboxbtn' src='/images/show.jpg' onclick='formSubmit(0)' /></p>
    	</div>
    
    	<div class='srchboxborderbottom'> </div>	
    
    </div>
    
    <div class='clearfloats'></div>
    
    <div style="width: 30%;" class="floatright">
    
    	<div style="text-align: right; width: 40%;" class="floatleft">Sort by:</div>
    	<div class="floatright">
    		<select style="display: inline; width: 100px; font-size: 10px;" class="floatright" onchange=fieldClick() type='option' id='sortpref' name='sortpref'>						
    			<option>Buyer rating</option>
    			<option>Price (low to high)</option>
    			<option>Price (high to low)</option>
    		</select>
    	</div>
    
    </div>
    
    <div class='clearfloats'></div>
    
    _END;

     

    A3 and A4 srchbox code are same but these have different php page. I just want to combine them and have a search box for A3 and A4 under the checkbox. When they click on A4.. all the A4 should be displayed same goes for A3.

     

    Thank you for helping me.

  15. There should be result. A3 or A4.. you select one of these and it should print the A3 ones if A3 is selected. If its A4 then A4 will be printer. A4 works but A3 doesnt.. Yh I think so. How do I fix the return result..

  16. Awesome I found it :).. it works.. Thank you sooooooooooooooooooooooo much..

     

    One more.. one of the check bos isnt working. I know this should be something really simple but I dont know where the issue is.

     

    <p class='srchboxcoltitle'>Size</p>
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='A3' />A3</p>
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='A4' />A4</p>

     

    A4 is working but A3 isnt showing any results

  17. Someone already did this code for a company and I am just applying the same thing on another page using the same checkbox code page.. Its reading it from the same page so it should just work just like that.. unless the query is different.. but I checked that..

     

    So the

    <body onload="fieldClick('1')"> 

    wasnt on the new page and I have done this bit now. But its still not working :/

  18. Not using javascript. Yep it should be very simple. Use a form to post whats in the check post then use a $_POST or $_GET to the result. But its not. I cant seem to find any form. I am working on someone else code so not sure where is what.

     

    This is the code that process the checkbox

     

    	
    function nametourl( $str )
    {
    	$str = str_replace(' ', '_', $str); 
    	$str = trim($str);
    	return $str;
    }
    
    if ( isset( $_GET[ 'srchboxqry' ] ) && isset( $_GET[ 'pagenum' ] ) )
    {
    	$rowsPerPage = 10;
    	$pageNum = (int)$_GET[ 'pagenum' ]; 
    	$rowNum = ( $pageNum - 1 ) * $rowsPerPage;
    
    	$qry = $_GET[ 'srchboxqry' ];
    	$qry = str_replace( "\\", "", $qry );
    
    	//echo $qry; exit(0);
    	mysql_select_db( $database_statusplc, $statusplc );
    	$printerRS = mysql_query( $qry, $statusplc ) or die( mysql_error( ) );
    	$numRows = mysql_num_rows( $printerRS );
    
    	if ( $numRows == 0 )
    	{
    		echo "<p style='width: 100%; text-align: center; font-weight: bold; font-size: 18px; color: #990000;'>No printers found that match your criteria.</p>";
    		exit(0);
    	}
    
    	if ( $rowNum > 0 )
    		mysql_data_seek( $printerRS, $rowNum );
    
    ?>
    
    			<?php 
    			$record_count = 1;
    			$row_printerRS = mysql_fetch_assoc($printerRS);
    
    			do { 
    			if($record_count % 2 == 1){$rowclass="printerlistshade";}
    			else
    			{$rowclass="printerlistnoshade";}
    			?>
          
    <div class="<?php echo $rowclass; ?>">
    
    						<div class="div-full">
    						<h2><a style="margin-left:0px;" class="homep-h2" class="listnav" href="printer/<?php echo $row_printerRS['productid']; ?>/<?php echo $row_printerRS[name] ;?>.php"><?php echo $row_printerRS['manufacturer']; ?> <?php echo $row_printerRS['name']; ?> 
    						</a></h2>
    						</div>
    
    						<div class="printerlistname">
    
    						<p style="margin-top:0px;"><?php echo $row_printerRS['promo']; ?></p>
    
    						<strong><?php
    						if($row_printerRS['format'] == null){
    
    						echo  "N/A";
    
    						}else
    
    						{ echo $row_printerRS['format'];}
    
    						?>
    						<?php echo $row_printerRS['category']; ?> Printer</strong><br />
    
    						<img src="/images/bull.gif" /> <?php
    
    						$i = $row_printerRS['category'];
    
    						switch ($i) {
    
    						case "Mono Laser":
    
    						echo $row_printerRS['bwppm'] . " ppm";
    
    						break;
    
    						case "Colour Laser":
    
    						echo $row_printerRS['cppm'] . " ppm";
    
    						break;
    
    						case "Dot Matrix":
    
    						echo $row_printerRS['bwppm'] . " cps";
    
    						break;
    
    						case "Inkjet":
    
    						echo $row_printerRS['bwppm'] . " ppm";
    
    						break;
    
    						case "Line":
    
    						echo $row_printerRS['bwppm'] . " lpm";
    
    						break;
    
    						case "Wide":
    
    						echo $row_printerRS['cppm'] . " m<sup>2</sup> hour";
    
    						break;
    
    						case "Fax":
    
    						echo $row_printerRS['Fmodem'] . " Kbs";
    
    						break;
    
    						case "Multifunction":
    
    						echo $row_printerRS['bwppm'] . " ppm";
    
    						break;
    
    						default:
    
    						}
    
    						?>
    
    						<br />
    
    						<img src="/images/bull.gif" /> <?php echo $row_printerRS['resolution']; ?> dpi
    		  
    
    						<div class="special-stuff">*** <?php echo $row_printerRS['specialhead']; ?> ***</div>
    		  
    						</div>
                 
    						<div class="printerlistpic">
    
    						<?php 
    						$name = $row_printerRS['manufacturer'] . " " . $row_printerRS['name'];
    						if($row_printerRS['image'] == ''){ ?>
    						<a class="search" href="printer/<?php echo $row_printerRS['productid']; ?>/<?php echo nametourl($name) ;?>.php"><img onerror="ImgError(this);" src="images/products/<?php echo $row_printerRS['productid']; ?>.jpg" width="120"  border="0" alt="<?php echo $row_printerRS['name'];?>"></a>
    						<?php }else{ ?>
    						<a class="search" href="printer/<?php echo $row_printerRS['productid']; ?>/<?php echo nametourl($name) ;?>.php"><img onerror="ImgError(this);" src="images/products/<?php echo $row_printerRS['image']; ?>" width="120" border="0" alt="<?php echo $row_printerRS['name'];?>"></a>
    						<?php } ?>
    
    						<a href="printer/<?php echo $row_printerRS['productid']; ?>/<?php echo nametourl($name) ;?>.php"><img src="/images/more-info-sml.jpg" border="0" alt="More Information on this printer" /></a>
    
    						</div>
                
    						<div class="printerlistprice">
    
    						JUST<br />
    
    						<span class="lp-price"><?php echo "£" ;
    
    						printf("%1.2f", $row_printerRS['rrp']); ?></span> <span class="sml-txt">(ex VAT)</span>		
    
    						</div>
    
    					</div>
    			<?php 
    			$record_count = $record_count + 1;
    			} while ( ( $row_printerRS = mysql_fetch_assoc($printerRS) ) && ( $record_count <= $rowsPerPage ) ); ?>
    <?php 				
    echo <<<_END
    
    	<div class='clearfloats'></div>
    	<div class='srchboxbtns'>
    _END;
    
    		if ( $pageNum > 1 )
    			echo "<div class='floatleft'><img style='cursor: pointer;' id='btnprev' onclick='btnPrev()' src='images/prev_orange.gif' border='0'></div>";
    
    		if ( $numRows - ( $pageNum * $rowsPerPage ) > 0 )
    			echo "<div class='floatright'><img style='cursor: pointer;' id='btnnext' onclick='btnNext()' src='images/next_orange.gif' border='0'></div>";
    
    		echo "<div class='clearfloats'></div>";
    
    		if ( $numRows <= $rowsPerPage )
    			$pageTotal = 1;
    		else
    		{
    			$pageTotal = floor( $numRows / $rowsPerPage );
    			$pageTotal += ( $numRows % $rowsPerPage > 0 ) ? 1 : 0;
    		}
    		echo "<div class='srchboxpageinfo'>Page {$pageNum} of {$pageTotal}</div>";
    
    echo <<<_END
    	</div>
    
    _END;
    
    }

  19. I have a checkbox on a page and it works fine but if I copy the same thing to a different page with the exact same thing it wont work. Any idea why? I thought because of query but its using the same query to everything.

     

    <?php $srchboxFormat = "A4"; $srchboxCategory = "Colour Laser";  $srchBoxHeading = "A4 Colour Laser Printer Finder"; require_once('includes/srchbox.php'); ?>
    

    This is the file that shows the search box.

     

    The code below shows the srchbox.php file

     

    echo <<<_END
    
    
    <div class='srchbox'>
    <div class='srchboxbordertop'> </div>	
    
    	<p class='srchboxheading'>{$srchBoxHeading}</p>
    
    	<p class='srchboxhidden' id='format' name='format'>{$srchboxFormat}</p>
    	<p class='srchboxhidden' id='category' name='category'>{$srchboxCategory}</p>
    	<p class='srchboxhidden' id='pagenum' name='pagenum'>1</p>
    
    	<div style='margin-left: 10px;' class='srchboxcolumn'>
    
    			<p class='srchboxcoltitle'>Connectivity</p>
    
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='usb' />USB</p>
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='ethernet' />Network</p>
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='wireless' />Wireless</p>
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='parallel' />Parallel</p>
    
    	</div>
    
    	<div class='srchboxcolumn'>
    
    			<p class='srchboxcoltitle'>Double-sided print</p>
    
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='duplex' />Automatic</p>
    
    	</div>
    
    	<div class='srchboxcolumn'>
    
    			<p class='srchboxcoltitle'>Compatibility</p>
    
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='windows' />Windows</p>
    			<p class='srchboxfield'><input class='srchboxtick' onclick=fieldClick() value='' type='checkbox' id='mac' />Mac</p>
    
    			<p style='margin-top:38px' class='floatright'><img class='srchboxbtn' src='/images/reset.jpg' onclick='formReset()'/></p>
    
    			<div class='clearfloats'></div>
    	</div>
    
    	<div class='srchboxcolumn'>
    
    	<div class="floatleft" style="width: 100%; height: 100px; margin: 0px;">
    				<p class='srchboxcoltitle'>Price range</p>
    
    				<div class='floatleft'>Min price(£)</div>
    				<div class="floatright">
    					<select class="floatright" onchange=fieldClick() type='option' id='rrpmin' name='rrpmin'>						
    						<option>0</option>
    						<option>100</option>
    						<option>200</option>
    						<option>300</option>
    						<option>400</option>
    						<option>500</option>
    						<option>600</option>
    						<option>700</option>
    						<option>800</option>
    						<option>900</option>
    						<option>1000</option>
    						<option>1500</option>
    						<option>2000</option>
    						<option>3000</option>
    						<option>4000</option>
    						<option>5000</option>
    						<option>10000</option>
    					</select>
    				</div>	
    
    				<div class='clearfloats'></div>
    
    				<p></p>
    
    				<div class='floatleft'>Max price(£)</div>
    				<div class="floatright">
    					<select onchange=fieldClick() type='option' id='rrpmax' name='rrpmax' />
    						<option>0</option>
    						<option>100</option>
    						<option>200</option>
    						<option>300</option>
    						<option>400</option>
    						<option>500</option>
    						<option>600</option>
    						<option>700</option>
    						<option>800</option>
    						<option>900</option>
    						<option>1000</option>
    						<option>1500</option>
    						<option>2000</option>
    						<option>3000</option>
    						<option>4000</option>
    						<option>5000</option>
    						<option>10000</option>
    					</select>
    				</div>
    
    	</div>
    
    		<div class='clearfloats'></div>
    		<div id='srchboxmatch' class='srchboxmatch'>searching...</div>
    		<p style="margin-top: 6px;" class='floatright'><img class='srchboxbtn' src='/images/show.jpg' onclick='formSubmit(0)' /></p>
    	</div>
    
    	<div class='srchboxborderbottom'> </div>	
    
    </div>
    
    <div class='clearfloats'></div>
    
    <div style="width: 30%;" class="floatright">
    
    	<div style="text-align: right; width: 40%;" class="floatleft">Sort by:</div>
    	<div class="floatright">
    		<select style="display: inline; width: 100px; font-size: 10px;" class="floatright" onchange=fieldClick() type='option' id='sortpref' name='sortpref'>						
    			<option>Buyer rating</option>
    			<option>Price (low to high)</option>
    			<option>Price (high to low)</option>
    		</select>
    	</div>
    
    </div>
    
    <div class='clearfloats'></div>
    
    _END;

     

    After this.. there is another file which reads the selection and display the result.

     

    can someone please help me

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.