nordarv Posted October 4, 2017 Share Posted October 4, 2017 (edited) 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 October 17, 2017 by gizmola Code tags Quote Link to comment https://forums.phpfreaks.com/topic/305209-please-help-i-fued-up-a-page/ Share on other sites More sharing options...
benanamen Posted October 4, 2017 Share Posted October 4, 2017 (edited) 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. Edited October 4, 2017 by benanamen Quote Link to comment https://forums.phpfreaks.com/topic/305209-please-help-i-fued-up-a-page/#findComment-1552380 Share on other sites More sharing options...
nordarv Posted October 4, 2017 Author Share Posted October 4, 2017 (edited) 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 October 5, 2017 by cyberRobot Please enclose code with [code][/code] tags Quote Link to comment https://forums.phpfreaks.com/topic/305209-please-help-i-fued-up-a-page/#findComment-1552381 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. Quote Link to comment https://forums.phpfreaks.com/topic/305209-please-help-i-fued-up-a-page/#findComment-1552382 Share on other sites More sharing options...
cyberRobot Posted October 5, 2017 Share Posted October 5, 2017 (edited) 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 Edited October 5, 2017 by cyberRobot Quote Link to comment https://forums.phpfreaks.com/topic/305209-please-help-i-fued-up-a-page/#findComment-1552401 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. Quote Link to comment https://forums.phpfreaks.com/topic/305209-please-help-i-fued-up-a-page/#findComment-1552402 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> Quote Link to comment https://forums.phpfreaks.com/topic/305209-please-help-i-fued-up-a-page/#findComment-1552784 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> Quote Link to comment https://forums.phpfreaks.com/topic/305209-please-help-i-fued-up-a-page/#findComment-1552820 Share on other sites More sharing options...
cloetensbrecht Posted October 19, 2017 Share Posted October 19, 2017 (edited) <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 October 19, 2017 by cloetensbrecht Quote Link to comment https://forums.phpfreaks.com/topic/305209-please-help-i-fued-up-a-page/#findComment-1552821 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.