nordarv Posted October 4, 2017 Share Posted October 4, 2017 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> Link to comment Share on other sites More sharing options...
benanamen Posted October 4, 2017 Share Posted October 4, 2017 For starters you are missing numerous closing tags, HTML and Php and Semi-colons. If you view it in a proper IDE you would see it. Also, use code tags when you post here. Link to comment Share on other sites More sharing options...
nordarv Posted October 4, 2017 Author Share Posted October 4, 2017 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.. Link to comment Share on other sites More sharing options...
benanamen Posted October 5, 2017 Share Posted October 5, 2017 Why don't you just upload the backup copy you made before you started editing the file? You did make a backup right? Do you notice anything about those two lines you just posted? What is different? There is your answer. Link to comment Share on other sites More sharing options...
cyberRobot Posted October 5, 2017 Share Posted October 5, 2017 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: http://php.net/manual/en/language.types.string.php Link to comment Share on other sites More sharing options...
ginerjm Posted October 5, 2017 Share Posted October 5, 2017 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 More sharing options...
dodgeitorelse3 Posted October 17, 2017 Share Posted October 17, 2017 <?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 More sharing options...
cloetensbrecht Posted October 19, 2017 Share Posted October 19, 2017 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 More sharing options...
cloetensbrecht Posted October 19, 2017 Share Posted October 19, 2017 <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> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.