dahwan Skrevet 25. april 2009 Del Skrevet 25. april 2009 (endret) <!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>Bekreft bestilling</title> <?php $content = "unfilled"; ?> </head> <body> <form method="post" action="confirmed.php" target="_self" name="confirmform"> <input type="text" name="confirmformname" /> <input type="text" name="confirmformaddress" /> <input type="text" name="confirmformcont" /> </form> <h1>Bekreft bestilling</h1> <p> <?php if($_GET['fullname'] && $_GET['address']) { ob_start(); echo "<table><tr>"; echo '<td style="min-width: 75px">Navn: </td><td>' . $_GET['fullname'] . "</td>"; echo "</tr><tr>"; echo "<td>Adresse: </td><td>" . $_GET['address'] . "</td>"; echo "</tr></table>"; echo "<p>"; if($_GET['_GraSmall']) echo $_GET['_GraSmall'] . "x JOGGEBUKSE - ART. 7700 - Grå Small <br />"; if($_GET['_GraMedium']) echo $_GET['_GraMedium'] . "x JOGGEBUKSE - ART. 7700 - Grå Medium <br />"; if($_GET['_GraLarge']) echo $_GET['_GraLarge'] . "x JOGGEBUKSE - ART. 7700 - Grå Large <br />"; if($_GET['_GraXL']) echo $_GET['_GraXL'] . "x JOGGEBUKSE - ART. 7700 - Grå XL <br />"; if($_GET['_GraXXL']) echo $_GET['_GraXXL'] . "x JOGGEBUKSE - ART. 7700 - Grå XXL <br />"; if($_GET['_MarineSmall']) echo $_GET['_MarineSmall'] . "x JOGGEBUKSE - ART. 7700 - Marine Small <br />"; if($_GET['_MarineMedium']) echo $_GET['_MarineMedium'] . "x JOGGEBUKSE - ART. 7700 - Marine Medium <br />"; if($_GET['_MarineLarge']) echo $_GET['_MarineLarge'] . "x JOGGEBUKSE - ART. 7700 - Marine Large <br />"; if($_GET['_MarineXL']) echo $_GET['_MarineXL'] . "x JOGGEBUKSE - ART. 7700 - Marine XL <br />"; if($_GET['_MarineXXL']) echo $_GET['_MarineXXL'] . "x JOGGEBUKSE - ART. 7700 - Marine XXL <br />"; if($_GET['_SortSmall']) echo $_GET['_SortSmall'] . "x JOGGEBUKSE - ART. 7700 - Sort Small <br />"; if($_GET['_SortMedium']) echo $_GET['_SortMedium'] . "x JOGGEBUKSE - ART. 7700 - Sort Medium <br />"; if($_GET['_SortLarge']) echo $_GET['_SortLarge'] . "x JOGGEBUKSE - ART. 7700 - Sort Large <br />"; if($_GET['_SortXL']) echo $_GET['_SortXL'] . "x JOGGEBUKSE - ART. 7700 - Sort XL <br />"; if($_GET['_SortXXL']) echo $_GET['_SortXXL'] . "x JOGGEBUKSE - ART. 7700 - Sort XXL <br />"; if($_GET['/GraSmall']) echo $_GET['/GraSmall'] . "x JOGGEBUKSE Camus Agger - Grå Small <br />"; if($_GET['/GraMedium']) echo $_GET['/GraMedium'] . "x JOGGEBUKSE Camus Agger - Grå Medium <br />"; if($_GET['/GraLarge']) echo $_GET['/GraLarge'] . "x JOGGEBUKSE Camus Agger - Grå Large <br />"; if($_GET['/GraXL']) echo $_GET['/GraXL'] . "x JOGGEBUKSE Camus Agger - Grå XL <br />"; if($_GET['/GraXXL']) echo $_GET['/GraXXL'] . "x JOGGEBUKSE Camus Agger - Grå XXL <br />"; echo "</p>"; $content = urlencode(ob_get_flush()); echo "<p>"; echo '<input type="button" value="Bekreft" onclick="confirmed()" />'; echo "</p>"; } else echo "Både navn og adresse må fylles ut!"; ?> </p> <?php // echo "<script>alert('$content');</script>"; ?> <script> function confirmed() { document.confirmform.confirmformaddress.value = "<?php echo $_GET['address']; ?>"; document.confirmform.confirmformname.value = "<?php echo $_GET['fullname']; ?>"; document.confirmform.confirmformcont.value = "testcontent"; document.confirmform.submit(); } </script> </body> </html> Når submitt trykkes på fylles de to første tekstfeltene, men ikke det tredje. Får denne erroren i opera error console. JavaScript - http://localhost:26089/confirmOrder.php?fu...amp;%2FGraXXL=0Event thread: click Error: name: TypeError message: Statement on line 6: Cannot convert undefined or null to Object Backtrace: Line 6 of inline#1 script in http://localhost:26089/confirmOrder.php?fu...mp;%2FGraXXL=0: In function confirmed document.confirmform.confirmformcontent.value = "testcontent"; Line 1 of function script confirmed() ... stacktrace: n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace' Endret 25. april 2009 av dahwan Lenke til kommentar
dahwan Skrevet 25. april 2009 Forfatter Del Skrevet 25. april 2009 (endret) Oh bay the dubbelyew, dette er koden etter serverkompilering <!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>Bekreft bestilling</title> </head> <body> <h1>Bekreft bestilling</h1> <p> <table><tr><td style="min-width: 75px">Navn: </td><td>qwer</td></tr><tr><td>Adresse: </td><td>tyuio</td></tr></table><p>3x JOGGEBUKSE - ART. 7700 - Grå Small <br /></p><p><input type="button" value="Bekreft" onclick="confirmed()" /></p> </p> <form method="post" action="confirmed.php" target="_self" name="confirmform"> <input type="text" name="confirmformname" /> <input type="text" name="confirmformaddress" /> <input type="text" name="confirmformcont" /> </form> <script> function confirmed() { document.confirmform.confirmformaddress.value = "tyuio"; document.confirmform.confirmformname.value = "qwer"; document.confirmform.confirmformcont.value = "testcontent"; document.confirmform.submit(); } </script> </body> </html> Penere versjon av kode http://pastey.net/113056 Endret 25. april 2009 av dahwan Lenke til kommentar
norpheus Skrevet 21. august 2009 Del Skrevet 21. august 2009 Jeg tipper feilen er at det ikke eksisterer et element i formen confirmform med navn confirmformcontent: <input type="text" name="confirmformcont" /> document.confirmform.confirmformcontent.value = "testcontent"; Prøv å endre document.confirmform.confirmformcontent.value = "testcontent"; til document.confirmform.confirmformcont.value = "testcontent"; Lenke til kommentar
Anbefalte innlegg
Opprett en konto eller logg inn for å kommentere
Du må være et medlem for å kunne skrive en kommentar
Opprett konto
Det er enkelt å melde seg inn for å starte en ny konto!
Start en kontoLogg inn
Har du allerede en konto? Logg inn her.
Logg inn nå