Jump to content

Please help, i fu..ed up a page..


nordarv
 Share

Recommended Posts

Please, I did some changes on a page made of a company that helped me. After some editing, it dont work..

 

Please, anyone....

 

 
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Dekkalkulator</title>
<link rel="stylesheet" href="style.css">
</head>
<body id="results-body">
<?php
$bredde = $_GET['bredde'];
$profil = $_GET['profil'];
$felg = $_GET['felg'];
$type = $_GET['type'];
$size = $bredde . "/" . $profil . "R" . $felg;
$title = false;
?>
<div id="results-wrap">
<h3>Priseksempel <?php echo $type;?>dekk med dimensjonen <?php echo $size;?>:</h3>
<div id='info' class='results'><b></b> Priser oppdatert 05/10.
<div id='info' class='results'><b>Priser på noe av vårt utvalg. Glem konkurrentenes rabatter, sjekk RINGDEKK pris</b> 
<div id='info' class='results'><b>Vi har dekk i alle prisklasser, men har valgt dekk som vi kan anbefale</b> Vi hjelper deg gjerne med valget.
<br> <br></br>   
<table id="results" class="results" cellpadding="0" cellspacing="0">
<thead>
<tr>
<td>Dimensjon</td>
<td>Merke og type</td>
<td>LI</td>
<td>Pris</td>
<td><center>Pris 4 dekk ferdig montert</center></td>
</tr>
</thead>
<?php
$i = 0; 
if (($handle = fopen("prislister/$type.csv","r")) !== FALSE) {
  while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
    if($data[0] == $size) {
     echo "<tr>";
     echo "<td>$data[0]</td>";
     echo "<td>$data[1]</td>";
     echo "<td>$data[2]</td>";
     echo "<td>kr $data[3],-</td>";
     echo "<td><center><b>kr " . (($data[3]*4)+700) . ",-</b></center></td>";
     echo "</tr>";
     $i++;
    }
  }
  echo "</table>";
  echo "<div id='info' class='results'>Alle priser er inklusiv miljøavgift og mva. Montering er inkludert i prisen lengst til høyre.<br><br>"
  echo '<a target="_blank" href="[url=http://www.ringdekk.no/nyedekk.html]http://www.ringdekk.no/nyedekk.html[/url]" class="button">Bestill time</a>'
     echo '<a class="button" onclick="window.print()">Skriv ut</a><br><br>
     echo "<div class='boks'><strong>Ringdekk AS</strong><br>Risesletta<br>3513 Hønefoss<br><br>Telefon: 32 11 11 74<br>24t vakt: 405 24 000<b></div>";
  echo "<div class='boks'><strong>Ordinære åpningstider</strong><br>08 - 17<br>10 - 14<br><br><br><br></div>"
  echo "<div class='boks'><strong>I sesong</strong><br>08 - 24<br>09 - 16<br><br><br><br></div>"
  echo "</div>";
  if($i == 0) {
     echo "Ingen resultater.";
     echo "<style>.results {display:none;}</style>";
     }
  fclose($handle);
}
?>
    </div>
 
</body>
Edited by gizmola
Code tags
Link to comment
Share on other sites

OK, sorry.....

I buy this code from a company, but after editing the page dont work.. The wrong code is here

 

echo '<a target="_blank" href="http://www.ringdekk.no/nyedekk.html" class="button">Bestill time</a>';
echo '<a class="button" onclick="window.print()">Skriv ut</a><br><br>
 
But I understand that I post it wrong and have no ide fix this..
Edited by cyberRobot
Please enclose code with [code][/code] tags
Link to comment
Share on other sites

Unless you fixed them already, there is a PHP error in all but 1 line below:

echo "<div id='info' class='results'>Alle priser er inklusiv miljøavgift og mva. Montering er inkludert i prisen lengst til høyre.<br><br>"
echo '<a target="_blank" href="http://www.ringdekk.no/nyedekk.html" class="button">Bestill time</a>'
echo '<a class="button" onclick="window.print()">Skriv ut</a><br><br>
echo "<div class='boks'><strong>Ringdekk AS</strong><br>Risesletta<br>3513 Hønefoss<br><br>Telefon: 32 11 11 74<br>24t vakt: 405 24 000<b></div>";
echo "<div class='boks'><strong>Ordinære åpningstider</strong><br>08 - 17<br>10 - 14<br><br><br><br></div>"
echo "<div class='boks'><strong>I sesong</strong><br>08 - 24<br>09 - 16<br><br><br><br></div>"
 
Hint: The line for "Ringdekk AS" is the correct one. Note the end of each echo statement. If you're still not sure, perhaps the manual will help:
Edited by cyberRobot
Link to comment
Share on other sites

If the code we are seeing is anything like what you purchased, you got taken.  Good programming style in PHP separates the HTML,JS,CSS from the PHP.  And usually the PHP is the first element of a script.  Yours starts out with the html document itself, leading to a mass of spaghetti code from there on in.

 

Looks like it was written by a newbie like you.  Hope you didn't pay too much.

 

And as said by benanamen - reload the file from the source file you bought.  Or go buy a better script.

Link to comment
Share on other sites

  • 2 weeks later...


<?php
$bredde = $_GET['bredde'];
$profil = $_GET['profil'];
$felg = $_GET['felg'];
$type = $_GET['type'];
$size = $bredde . "/" . $profil . "R" . $felg;
$title = false;
?>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Dekkalkulator</title>
<link rel="stylesheet" href="style.css">
</head>
<body id="results-body">
<div id="results-wrap">
<h3>Priseksempel <?php echo $type;?>dekk med dimensjonen <?php echo $size;?>:</h3>
<div id='info' class='results'><b></b> Priser oppdatert 05/10.</div>
<div id='info' class='results'><b>Priser på noe av vårt utvalg. Glem konkurrentenes rabatter, sjekk RINGDEKK pris</b> </div>
<div id='info' class='results'><b>Vi har dekk i alle prisklasser, men har valgt dekk som vi kan anbefale</b> Vi hjelper deg gjerne med valget.
<br> <br></br>
<table id="results" class="results" cellpadding="0" cellspacing="0">
<thead>
<tr>
<td>Dimensjon</td>
<td>Merke og type</td>
<td>LI</td>
<td>Pris</td>
<td><center>Pris 4 dekk ferdig montert</center></td>
</tr>
</thead>
<?php
$i = 0;
if (($handle = fopen("prislister/$type.csv","r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
if($data[0] == $size) {
?>
<tr>
<td><?php echo $data[0]; ?></td>
<td><?php echo $data[1]; ?></td>
<td><?php echo $data[2]; ?></td>
<td><?php echo "kr". $data[3].",-"; ?></td>
<td><center><b><?php echo "kr".(($data[3]*4)+700).",-"; ?></b></center></td>
</tr>
<?php
$i++;
}
}
?>
</table>
<div id='info' class='results'>Alle priser er inklusiv miljøavgift og mva. Montering er inkludert i prisen lengst til høyre.
<br><br>
<a target="_blank" href="http://www.ringdekk.no/nyedekk.html" class="button">Bestill time</a>
<a class="button" onclick="window.print()">Skriv ut</a>
<br><br>
</div>
<div class='boks'><strong>Ringdekk AS</strong><br>Risesletta<br>3513 Hønefoss<br><br>Telefon: 32 11 11 74<br>24t vakt: 405 24 000<b></div>
<div class='boks'><strong>Ordinære åpningstider</strong><br>08 - 17<br>10 - 14<br><br><br><br></div>
<div class='boks'><strong>I sesong</strong><br>08 - 24<br>09 - 16<br><br><br><br></div>
</div>
<?php
if($i == 0) {
echo "Ingen resultater.";
echo "<style>.results {display:none;}</style>";
}
fclose($handle);
}
?>
</div>

</body>
</html>

 

Link to comment
Share on other sites

If you bought this code from a company.. the company is terrible.

<?php
	$bredde = $_GET['bredde'];
	$profil = $_GET['profil'];
	$felg = $_GET['felg'];
	$type = $_GET['type'];
	$size = $bredde . "/" . $profil . "R" . $felg;
	$title = false;
	$pricelist = [];
	
	function priceFormat($price) {
		return 'kr '.$price.',-';
	}
	
	// fill the pricelist array with data
	if (($handle = fopen("prislister/$type.csv","r")) !== FALSE) {
	  while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
		if($data[0] == $size) {
			$item = new stdClass();
			$item->dimensjon = $data[0];
			$item->type = $data[1];
			$item->li = $data[2];
			$item->pris = $data[3];
			$item->montert = ($data[3] * 4) + 700;
			$pricelist[] = $item;
		}
	  }
	  fclose($handle);
	}
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>Dekkalkulator</title>
	<link rel="stylesheet" href="style.css">
</head>
<body id="results-body">
	<div id="results-wrap">
		<h3>Priseksempel <?php echo $type;?>dekk med dimensjonen <?php echo $size;?>:</h3>
		<?php if (count($priceList)): ?>
			<div id='info' class='results'><b></b> Priser oppdatert 05/10.
			<div id='info' class='results'><b>Priser på noe av vårt utvalg. Glem konkurrentenes rabatter, sjekk RINGDEKK pris</b> 
			<div id='info' class='results'><b>Vi har dekk i alle prisklasser, men har valgt dekk som vi kan anbefale</b> Vi hjelper deg gjerne med valget.
			<br><br><br>   
			<table id="results" class="results" cellpadding="0" cellspacing="0">
				<thead>
					<tr>
						<td>Dimensjon</td>
						<td>Merke og type</td>
						<td>LI</td>
						<td>Pris</td>
						<td><center>Pris 4 dekk ferdig montert</center></td>
					</tr>
				</thead>
				<tbody>
					<?php foreach($priceList as $item): ?>
						<tr>
							<td><?php echo $item->dimensjon; ?></td>
							<td><?php echo $item->type; ?></td>
							<td><?php echo $item->li; ?></td>
							<td><?php echo priceFormat($item->pris); ?></td>
							<td><?php echo priceFormat($item->montert); ?></td>
						</tr>
					<?php endforeach; ?>
				</tbody>
			</table>
			<div id='info' class='results'>
				Alle priser er inklusiv miljøavgift og mva. Montering er inkludert i prisen lengst til høyre.<br>
				<br>
				<a target="_blank" href="http://www.ringdekk.no/nyedekk.html" class="button">Bestill time</a>
				<a class="button" onclick="window.print()">Skriv ut</a><br>
				<br>
				<div class='boks'>
					<strong>Ringdekk AS</strong><br>
					Risesletta<br>
					3513 Hønefoss<br>
					<br>
					Telefon: 32 11 11 74<br>
					24t vakt: 405 24 000
				</div>
				<div class='boks'>
					<strong>Ordinære åpningstider</strong><br>
					08 - 17<br>
					10 - 14<br>
					<br><br><br>
				</div>
				<div class='boks'>
					<strong>I sesong</strong><br>
					08 - 24<br>
					09 - 16<br>
					<br><br><br>
				</div>
			</div>
		<?php else: ?>
			<p>Ingen resultater.</p>
		<?php endif; ?>
	</div>
</body>
</html>
Link to comment
Share on other sites

<div id='info' class='results'> was not closed correctly. And an id should only be used once on a single page, so I grouped your text into one div.

<?php
	$bredde = $_GET['bredde'];
	$profil = $_GET['profil'];
	$felg = $_GET['felg'];
	$type = $_GET['type'];
	$size = $bredde . "/" . $profil . "R" . $felg;
	$title = false;
	$pricelist = [];
	
	function priceFormat($price) {
		return 'kr '.$price.',-';
	}
	
	// fill the pricelist array with data
	if (($handle = fopen("prislister/$type.csv","r")) !== FALSE) {
	  while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
		if($data[0] == $size) {
			$item = new stdClass();
			$item->dimensjon = $data[0];
			$item->type = $data[1];
			$item->li = $data[2];
			$item->pris = $data[3];
			$item->montert = ($data[3] * 4) + 700;
			$pricelist[] = $item;
		}
	  }
	  fclose($handle);
	}
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>Dekkalkulator</title>
	<link rel="stylesheet" href="style.css">
</head>
<body id="results-body">
	<div id="results-wrap">
		<h3>Priseksempel <?php echo $type;?>dekk med dimensjonen <?php echo $size;?>:</h3>
		<?php if (count($priceList)): ?>
			<div id='info' class='results'>
				<b>Priser oppdatert 05/10.<br>
				Priser på noe av vårt utvalg. Glem konkurrentenes rabatter, sjekk RINGDEKK pris<br>
				Vi har dekk i alle prisklasser, men har valgt dekk som vi kan anbefale</b> Vi hjelper deg gjerne med valget.<br>
				<br><br>
				<table id="results" class="results" cellpadding="0" cellspacing="0">
					<thead>
						<tr>
							<td>Dimensjon</td>
							<td>Merke og type</td>
							<td>LI</td>
							<td>Pris</td>
							<td><center>Pris 4 dekk ferdig montert</center></td>
						</tr>
					</thead>
					<tbody>
						<?php foreach($priceList as $item): ?>
							<tr>
								<td><?php echo $item->dimensjon; ?></td>
								<td><?php echo $item->type; ?></td>
								<td><?php echo $item->li; ?></td>
								<td><?php echo priceFormat($item->pris); ?></td>
								<td><?php echo priceFormat($item->montert); ?></td>
							</tr>
						<?php endforeach; ?>
					</tbody>
				</table>
				Alle priser er inklusiv miljøavgift og mva. Montering er inkludert i prisen lengst til høyre.<br>
				<br>
				<a target="_blank" href="http://www.ringdekk.no/nyedekk.html" class="button">Bestill time</a>
				<a class="button" onclick="window.print()">Skriv ut</a><br>
				<br>
				<div class='boks'>
					<strong>Ringdekk AS</strong><br>
					Risesletta<br>
					3513 Hønefoss<br>
					<br>
					Telefon: 32 11 11 74<br>
					24t vakt: 405 24 000
				</div>
				<div class='boks'>
					<strong>Ordinære åpningstider</strong><br>
					08 - 17<br>
					10 - 14<br>
					<br><br><br>
				</div>
				<div class='boks'>
					<strong>I sesong</strong><br>
					08 - 24<br>
					09 - 16<br>
					<br><br><br>
				</div>
			</div>
		<?php else: ?>
			<p>Ingen resultater.</p>
		<?php endif; ?>
	</div>
</body>
</html>
Edited by cloetensbrecht
Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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.