synchro_irl Posted February 27, 2008 Share Posted February 27, 2008 hey guys i have a big problem withone of all my text, everything is printing out in the bottom left hand corner as can be seen from the image: its only the text from the if statements that;s printing out there, any ideas what this might be. here is the code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- Design by Free CSS Templates http://www.freecsstemplates.org Released for free under a Creative Commons Attribution 2.5 License Name : Pluralism Description: A two-column, fixed-width template fit for 1024x768 screen resolutions. Version : 1.0 Released : 20071218 --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Search4Trade</title> <meta name="keywords" content="" /> <meta name="description" content="" /> <link href="style.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <div id="wrapper" style="width: 961px; height: 564px"> <div id="wrapper2"> <div id="header"> <div id="logo"> <h1><font size="6">search4trade.net</font></h1> </div> <div id="menu"> <ul style="line-height: 170%; text-align: justify; margin-left: 3em; margin-bottom: 1.5em"> <li><a href="Search1.html">Search </a></li> <li><a href="Login1.php">Login</a></li> <li><a href="#">Forum</a></li> <li><a href="registration.html">Register</a></li> <li><a href="adreview.html">Star Rating</a></li> <li><a href="#">Contact</a></li> </ul> </div> </div> <div id="page"> <div id="content" style="width: 766px; height: 205px"> <div class="post"> <div class="entry"> <p> </p> <p style="text-align: center"> </div> </div> </div> </div> </div> </div> <p style="text-align: center"> </p> </body> <?php //Database Information $dbhost = ""; $dbname = ""; $dbuser = ""; $dbpass = ""; //Connect to database mysql_connect( $dbhost, $dbuser, $dbpass) or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $username = $_POST['username']; $type = $_POST['type']; $StarRating = $_POST['StarRating']; $commentbox = $_POST['commentbox']; $name = $_POST['name']; if(!$_POST['username']){echo 'You must supply a username! click your back button and try again.';exit();} $check = mysql_query("SELECT * FROM mytable WHERE username = '".$_POST['username']."'")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That username does not exist in our database.'); } if(!$_POST['name']){echo 'You must supply an name! click your back button and try again.';exit();} $check = mysql_query("SELECT * FROM mytable WHERE name = '".$_POST['name']."'")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That tradesman does not exist in our database.'); } if(!$_POST['type']){echo 'You must supply a type! click your back button and try again.';exit();} if(!$_POST['StarRating']){echo 'You must supply an StarRating! click your back button and try again.';exit();} if(!$_POST['commentbox']){echo 'You must supply a comment! click your back button and try again.';exit();} else { // use a query to insert the data into the database. $query = "INSERT INTO myreviews (username, type,StarRating, commentbox, name) VALUES('$username', '$type','$StarRating','$commentbox','$name')"; mysql_query($query) or die(mysql_error()); mysql_close(); echo "Thank you for your Contribution!"; } ?> </html> Quote Link to comment Share on other sites More sharing options...
trq Posted February 27, 2008 Share Posted February 27, 2008 Your output is outside of the html <body> tags for starters. Quote Link to comment Share on other sites More sharing options...
deansatch Posted February 27, 2008 Share Posted February 27, 2008 A little tip to avoid things like this in future. First make a static html page with some dummy text where your dynamic text will go. Then write your php code to extract your info from your db and print. Copy and paste your php code over your dummy text. This way you know it will be in the right place and you know before you start your php coding if the page will look right. Quote Link to comment Share on other sites More sharing options...
synchro_irl Posted February 27, 2008 Author Share Posted February 27, 2008 sorted! thanks for yer help! really appreciate it 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.