sugarplum_19 Posted February 28, 2011 Share Posted February 28, 2011 why does my page display half way down the page if(!$_GET) { ?> <form action="<?php echo $_SERVER['php_self']?>" method="get" class="h2" position="centre" onSubmit="return validate()"> <p>Sandwich Platters </t> <input type="text" id="value1" name="value1" value="0"/> <name="Sumbit" onmouseout="javascript:addNumbers()"/> <br/> Light Finger Buffet <input type="text" id="value2" name="value2" value="0"/> <br/> <name="Sumbit" onmouseout="javascript:addNumbers()"/> Classic Finger Buffet <input type="text" id="value3" name="value3" value="0"/> <br/> <name="Sumbit" onmouseout="javascript:addNumbers()"/> Deluxe Finger Buffet <input type="text" id="value4" name="value4" value="0"/> <br/> <name="Sumbit" onmouseout="javascript:addNumbers()"/> Executive Finger Buffet <input type="text" id="value5" name="value5" value="0"/> <br/> <name="Sumbit" onmouseout="javascript:addNumbers()"/> Fork Buffet <input type="text" id="value6" name="value6" value="0"/> <br/> <name="Sumbit" onmouseout="javascript:addNumbers()"/> Subtotal <input type="text" id="subtotal" name="subtotal" value="" onFocus="blur();" /> <br/> VAT <input type="text" id="VAT" name="VAT" value="" onFocus="blur();"/> <br/> Total <input type="text" id="total" name="total" value="" onFocus="blur();"/> <br/> Deposit on Order <input type="text" id="deposit" name="deposit" value="" onFocus="blur();"/> <br/> Balance to Pay <input type="text" id="balance" name="balance" value="" onFocus="blur();"/> <br/> <input type="submit" value="Submit"> </p> </form> <?php } else { echo "<table border='0'>"; echo "<tr><td>Sandwich Platters</td><td>{$value1}</td></tr><br/>"; echo "<tr><td>Light Finger Buffet</td><td> {$value2}</td></tr><br/>"; echo "<tr><td>Classic Finger Buffet</td><td>{$value3}</td></tr><br/>"; echo "<tr><td>Deluxe Finger Buffet</td><td>{$value4}</td></tr><br/>"; echo "<tr><td>Executive Finger Buffet </td><td> {$value5}</td></tr><br/>"; echo "<tr><td>Fork Buffet </td><td> {$value6}</td></tr><br/>"; echo "<tr><td>Subtotal </td><td> £{$subtotal}</td></tr><br/>"; echo "<tr><td>VAT </td><td> £{$VAT}</td></tr><br/>"; echo "<tr><td>Total </td><td> £{$total}</td></tr><br/>"; echo "<tr><td>Deposit on Order </td><td>£{$deposit}</td></tr><br/>"; echo "<tr><td>Balance to Pay </td><td> £{$balance}</td></tr><br/>"; echo "</table>"; } ?> </body> Quote Link to comment https://forums.phpfreaks.com/topic/229132-why-do-my-page-display-half-way-down-the-page/ Share on other sites More sharing options...
litebearer Posted February 28, 2011 Share Posted February 28, 2011 1. please use tags to display your code. 2. need to see what precedes the code you have shown (ie ALL the code) Quote Link to comment https://forums.phpfreaks.com/topic/229132-why-do-my-page-display-half-way-down-the-page/#findComment-1180757 Share on other sites More sharing options...
floridaflatlander Posted February 28, 2011 Share Posted February 28, 2011 Do you have your display errors on ? Quote Link to comment https://forums.phpfreaks.com/topic/229132-why-do-my-page-display-half-way-down-the-page/#findComment-1180785 Share on other sites More sharing options...
sugarplum_19 Posted March 1, 2011 Author Share Posted March 1, 2011 No i do not get an error This is all my code <script language="javascript"> function addNumbers() { var val1 = parseInt(document.getElementById("value1").value ); var num1 = (val1 *2.50); var val2 = parseInt(document.getElementById("value2").value); var num2 = (val2 * 4.25); var val3 = parseInt(document.getElementById("value3").value); var num3 = (val3 * 6.50); var val4 = parseInt(document.getElementById("value4").value); var num4= (val4 * 7.50); var val5 = parseInt(document.getElementById("value5").value); var num5 = (val5 * 8.50); var val6 = parseInt(document.getElementById("value6").value); var num6= (val6 * 15.00); var sub= document.getElementById("subtotal"); sub.value = (num1+num2+num3+num4+num5+num6).toFixed(2); var VAT = document.getElementById("VAT"); VAT.value = (sub.value * .2).toFixed(2); var total = document.getElementById("total"); total.value = (parseFloat(sub.value)+parseFloat(VAT.value)).toFixed(2); var deposit = document.getElementById("deposit"); deposit.value = (total.value * .2).toFixed(2); var balance = document.getElementById("balance"); balance.value = (total.value-deposit.value).toFixed(2); } function validate() { var value1=document.getElementById("value1").value; submitOK="true"; if (isNaN(value1)|| value1<0) { alert("You Must Enter a Postive Number of Sandwich Platters"); submitOK="false"; } var value2=document.getElementById("value2").value; submitOK="true"; if (isNaN(value2)||value2<0) { alert("You Must Enter a Postive Number of Light Finger Buffet"); submitOK="false"; } var value3=document.getElementById("value3").value; submitOK="true"; if (isNaN(value3)||value3<0) { alert("You Must Enter a Postive Number of Classic Finger Buffet"); submitOK="false"; } var value4=document.getElementById("value4").value; submitOK="true"; if (isNaN(value4)||value4<0) { alert("You Must Enter a Postive Number of Deluxe Finger Buffet"); submitOK="false"; } var value5=document.getElementById("value5").value; submitOK="true"; if (isNaN(value5)||value5<0) { alert("You Must Enter a Postive Number of Executive Finger Buffet"); submitOK="false"; } var value6=document.getElementById("value6").value; submitOK="true"; if (isNaN(value6)||value6<0) { alert("You Must Enter a Postive Number of Fork Buffet"); submitOK="false"; } if ((value1 >250)||(value2>250)||(value3>250)||(value4>250)||(value5>250)||(value6>250)) { alert("Order exceed 250 Contact Us"); submitOK="false"; } if (!value1.match(/^\d+$|^\d+\.\d{0}$/)||!value2.match(/^\d+$|^\d+\.\d{0}$/)||!value3.match(/^\d+$|^\d+\.\d{0}$/)|| !value4.match(/^\d+$|^\d+\.\d{0}$/)||!value5.match(/^\d+$|^\d+\.\d{0}$/)||!value6.match(/^\d+$|^\d+\.\d{0}$/)) { alert("You Must Enter a whole Number"); submitok="false"; } } </script> <?php $value1 = $_GET['value1']; $value2 = $_GET['value2']; $value3 = $_GET['value3']; $value4 = $_GET['value4']; $value5 = $_GET['value5']; $value6 = $_GET['value6']; $subtotal = $_GET['subtotal']; $VAT = $_GET['VAT']; $total = $_GET['total']; $deposit = $_GET['deposit']; $balance = $_GET['balance']; if(!$_GET) { ?> <form action="<?php echo $_SERVER['php_self']?>" method="get" position="centre" onSubmit="return validate()"> Sandwich Platters <input type="text" id="value1" name="value1" value="0"/> <name="Sumbit" onmouseout="javascript:addNumbers()"/> <br/> Light Finger Buffet <input type="text" id="value2" name="value2" value="0"/> <br/> <name="Sumbit" onmouseout="javascript:addNumbers()"/> Classic Finger Buffet <input type="text" id="value3" name="value3" value="0"/> <br/> <name="Sumbit" onmouseout="javascript:addNumbers()"/> Deluxe Finger Buffet <input type="text" id="value4" name="value4" value="0"/> <br/> <name="Sumbit" onmouseout="javascript:addNumbers()"/> Executive Finger Buffet <input type="text" id="value5" name="value5" value="0"/> <br/> <name="Sumbit" onmouseout="javascript:addNumbers()"/> Fork Buffet <input type="text" id="value6" name="value6" value="0"/> <br/> <name="Sumbit" onmouseout="javascript:addNumbers()"/> Subtotal <input type="text" id="subtotal" name="subtotal" value="" onFocus="blur();" /> <br/> VAT <input type="text" id="VAT" name="VAT" value="" onFocus="blur();"/> <br/> Total <input type="text" id="total" name="total" value="" onFocus="blur();"/> <br/> Deposit on Order <input type="text" id="deposit" name="deposit" value="" onFocus="blur();"/> <br/> Balance to Pay <input type="text" id="balance" name="balance" value="" onFocus="blur();"/> <br/> <input type="submit" value="Submit"/> <?php } else { echo "<table border='0'> "; echo "<tr><td>Sandwich Platters</td><td>{$value1}</td></tr><br/>"; echo "<tr><td>Light Finger Buffet</td><td> {$value2}</td></tr><br/>"; echo "<tr><td>Classic Finger Buffet</td><td>{$value3}</td></tr><br/>"; echo "<tr><td>Deluxe Finger Buffet</td><td>{$value4}</td></tr><br/>"; echo "<tr><td>Executive Finger Buffet </td><td> {$value5}</td></tr><br/>"; echo "<tr><td>Fork Buffet </td><td> {$value6}</td></tr><br/>"; echo "<tr><td>Subtotal </td><td> £{$subtotal}</td></tr><br/>"; echo "<tr><td>VAT </td><td> £{$VAT}</td></tr><br/>"; echo "<tr><td>Total </td><td> £{$total}</td></tr><br/>"; echo "<tr><td>Deposit on Order </td><td>£{$deposit}</td></tr><br/>"; echo "<tr><td>Balance to Pay </td><td> £{$balance}</td></tr><br/>"; echo "</table>"; echo '<a href="javascript:history.go(-1)">go back</a>'; echo ' <a href="https://www.paypal.com">Submit</a>'; } ?> </form> Quote Link to comment https://forums.phpfreaks.com/topic/229132-why-do-my-page-display-half-way-down-the-page/#findComment-1181256 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.