jdm95lude Posted April 9, 2008 Share Posted April 9, 2008 http://www.roarytubbsdesigns.com/form/Shipping.php I have no idea why these warnings are coming up. Here is my code in the Shipping.php <?php //Variables from Order.php $Date = $_POST['date']; $Product = $_POST['prod']; $Quantity = $_POST['qty']; $Shipping = $_POST['ship']; $SubTotal = $_POST['sub']; $Tax = $_POST['tax']; $Total = $_POST['tot']; // Configures the current date. $Today = date("F j, Y"); // Sets cookies from past Order.php form. setcookie("date", "$Today", time()+3600); // Sets a cookie for the Product setcookie("prod", "$Product", time()+3600); // Sets a cookie for the Quantity setcookie("qty", "$Quantity", time()+3600); // Sets a cookie for the Shipping Price setcookie("ship", "$Shipping", time()+3600); // Sets a cookie for the SubTotal Price setcookie("sub", "$SubTotal", time()+3600); // Sets a cookie for the Tax Price setcookie("tax", "$Tax", time()+3600); // Sets a cookie for the Total Price setcookie("tot", "$Total", time()+3600); ?> Quote Link to comment Share on other sites More sharing options...
awpti Posted April 9, 2008 Share Posted April 9, 2008 Whitespace above <?php ? Whitespace in front of the < in <?php Or in an included script.. There is output being sent to the browser, it's not lying. Check for whitespace. Quote Link to comment Share on other sites More sharing options...
unsider Posted April 9, 2008 Share Posted April 9, 2008 It's most likely an error before the cookie values. As awpti said, check whitespace, and any included files, etc.. (i'm assuming that is only an excerpt from the full script). session_start(), etc.. Has to be before anything is output. Quote Link to comment Share on other sites More sharing options...
discomatt Posted April 9, 2008 Share Posted April 9, 2008 Also if its UTF-8 encoded there's an opening set of bits that the browser 'outputs' i believe. Quote Link to comment Share on other sites More sharing options...
jdm95lude Posted April 9, 2008 Author Share Posted April 9, 2008 Yeah thats what I searched and found that it has to be white space..... The funny thing is, is theres not any white space. I can't figure it out. This is my entire code for Shipping.php theres not any PHP code in Order.php which is where its getting the values from. [code]<html> <head> <title>FHM Product Order Form Shipping Information</title> <link href="scripts/style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="scripts/functions.js"></script> <script type="text/javascript"> /* This function will check to make sure every section is filled out properly. Note that the return keyword ends this function when one of the conditions is met. Thus, only one alert box will be displayed, even if more than one error is present in the form. */ function checkShipping() { if (document.Shipping.fname.value.length == 0) {alert ("You must enter a first name"); return false;} else if (document.Shipping.lname.value.length == 0) {alert("You must enter a last name"); return false;} else if (document.Shipping.address.value.length == 0) {alert("You must enter a address address"); return false;} else if (document.Shipping.city.value.length == 0) {alert("You must enter a city name"); return false;} else if (document.Shipping.state.value.length == 0) {alert("You must select a valid state"); return false;} else if (document.Shipping.zip.value.length != 5 ) {alert("You must enter a valid zip"); return false;} else if (document.Shipping.phoneA.value.length != 3) {alert("You must enter a valid phone number"); return false;} else if (document.Shipping.phoneB.value.length != 3) {alert("You must enter a valid phone number"); return false;} else if (document.Shipping.phoneC.value.length !=4) {alert("You must enter a valid phone number"); return false;} else return true; } </script> </head> <body> <?php //Variables from Order.php $Date = $_POST['date']; $Product = $_POST['prod']; $Quantity = $_POST['qty']; $Shipping = $_POST['ship']; $SubTotal = $_POST['sub']; $Tax = $_POST['tax']; $Total = $_POST['tot']; // Configures the current date. $Today = date("F j, Y"); // Sets cookies from past Order.php form. setcookie("date", "$Today", time()+3600); // Sets a cookie for the Product setcookie("prod", "$Product", time()+3600); // Sets a cookie for the Quantity setcookie("qty", "$Quantity", time()+3600); // Sets a cookie for the Shipping Price setcookie("ship", "$Shipping", time()+3600); // Sets a cookie for the SubTotal Price setcookie("sub", "$SubTotal", time()+3600); // Sets a cookie for the Tax Price setcookie("tax", "$Tax", time()+3600); // Sets a cookie for the Total Price setcookie("tot", "$Total", time()+3600); ?> <!--Calls the checkShipping() function to validate the form if everything is correct it goes to form 3. and resets the form when cancel is pressed--> <form name="Shipping" id="Shipping" method="post" action="Physician.php" onSubmit="return checkShipping()"> <div id="main"> <p id="logo"><img src="images/orderformheader.gif" alt="FHM-Logo" /></p> <h1>Delivery Form</h1> <fieldset> <legend>Enter your Contact Information</legend> <table> <tr> <td class="labelcell">First Name</td> <td class="inputcell2"> <input class="text" name="fname" id="fname" size="25" /></td> <td class="labelcel">Last Name</td> <td class="inputcell2"> <input class="text" name="lname" id="lname" size="25" /></td> </tr> <tr> <td class="labelcell">Address</td> <td class="inputcell2"> <input class="text" name="address" id="address" size="50" /></td> <td class="labelcell">Apt#</td> <td class="inputcell2"> <input class="text" name="apt" id="apt" size="3" maxlength="10"/></td> </tr> <tr> <td class="labelcell">City</td> <td class="inputcell2"> <input class="text" name="city" id="city" size="20" maxlength="25"/> <span class="fieldlabel">State</span> <select name="state"> <option value="" selected="selected">----Select</option> <option value="AL">AL</option> <option value="AR">AR</option> <option value="AZ">AZ</option> <option value="CA">CA</option> <option value="CO">CO</option> <option value="CT">CT</option> <option value="DE">DE</option> <option value="DC">DC</option> <option value="FL">FL</option> <option value="GA">GA</option> <option value="HI">HI</option> <option value="ID">ID</option> <option value="IL">IL</option> <option value="IN">IN</option> <option value="IA">IA</option> <option value="KS">KS</option> <option value="KY">KY</option> <option value="LA">LA</option> <option value="ME">ME</option> <option value="MD">MD</option> <option value="MA">MA</option> <option value="MI">MI</option> <option value="MN">MN</option> <option value="MS">MS</option> <option value="MO">MO</option> <option value="MT">MT</option> <option value="NE">NE</option> <option value="NV">NV</option> <option value="NH">NH</option> <option value="NJ">NJ</option> <option value="NM">NM</option> <option value="NY">NY</option> <option value="NC">NC</option> <option value="ND">ND</option> <option value="OH">OH</option> <option value="OK">OK</option> <option value="OR">OR</option> <option value="PA">PA</option> <option value="RI">RI</option> <option value="SC">SC</option> <option value="SD">SD</option> <option value="TN">TN</option> <option value="TX">TX</option> <option value="UT">UT</option> <option value="VT">VT</option> <option value="VA">VA</option> <option value="WA">WA</option> <option value="WV">WV</option> <option value="WI">WI</option> <option value="WY">WY</option> </select> <td class="labelcell">ZIP</td> <td class="inputcell2"> <input class="text" id="zip" name="zip" size="5" maxlength="7"/></td> </tr> <tr> <td class="labelcell">Phone</td> <td class="inputcell2"> (<input class="text" name="phoneA" id="phoneA" size="3" maxlength="3"/>) - <input class="text" name="phoneB" id="phoneB" size="3" maxlength="3"/> - <input class="text" name="phoneC" id="phoneC" size="4" maxlength="4"/></td> <td class="labelcell">Alt Phone</td> <td class="inputcell2"> (<input class="text" name="altphoneA" id="altphoneA" size="3" maxlength="3"/>) - <input class="text" name="altphoneB" id="altphoneA" size="3" maxlength="3"/> - <input class="text" name="altphoneC" id="altphoneA" size="4" maxlength="4"/></td> </tr> <tr> <td class="labelcell">Email Add.</td> <td class="inputcell2"> <input class="text" name="email" id="email" size="50" /></td> </tr> </table> </fieldset> <p id="formbuttons"> <input type="button" name="prevb" id="prevb" value="Previous" onClick="history.back()" /> <input type="submit" name="nextb" id="nextb" value="Next" /> </p> </div> </form> </body> </html> [/code] Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 9, 2008 Share Posted April 9, 2008 Those 41 or so lines of HTML/Javascript that you neglected to show in the first post (the line numbers in the error messages do not match what was shown) are all content that is sent to the browser. You cannot output any content to the browser before you send a header. Setcookie requires a header. You must put the php logic first, then put the HTML/Javascript content. Quote Link to comment Share on other sites More sharing options...
jdm95lude Posted April 9, 2008 Author Share Posted April 9, 2008 Thanks, that was exactly it. I thought PHP had to be in the <body> guess not. Thanks! Quote Link to comment Share on other sites More sharing options...
jdm95lude Posted April 9, 2008 Author Share Posted April 9, 2008 Well now theres another problem, when i put the php above the JavaScript it doesn't validate my fields. I mean I know I can do it in PHP but I like having alert boxes and the code is already in place. I really don't feel like re writing it again. Any ideas.... Quote Link to comment 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.