Lamez Posted August 24, 2007 Share Posted August 24, 2007 ok the personal detail page reads of the database to fill in the input fields, it finds the database using the common file config.php but it is having trouble reading the database or somthing because the input fields are all messed up here is my new page http://lamezz.com/login/members/profile/edit_profile.php?change=personalDetail here is my old page http://lamezz.com/login/members/profile.php use Username: test and Password: test here is my new script elseif ($getlink == "personalDetail") { //personal details changing print<<<pd <u><b>Your Personal Details</b></u><br /> <center><p>First Name: <br /> <input type="text" name="name1" value="<?php include "../../../config.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); $result = mysql_db_query($database, "select * from $table WHERE username = '$username'") or die (mysql_error()); while ($qry = mysql_fetch_array($result)) { echo "$qry[name1]"; } ?>" /> </p><p>Second Name: <br /> <input type="text" name="name2" value="<?php include "../config.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); $result = mysql_db_query($database, "select * from $table WHERE username = '$username'") or die (mysql_error()); while ($qry = mysql_fetch_array($result)) { echo "$qry[name2]"; } ?>" /> </p><p>Email Address: <br /> <input type="text" name="email" value="<?php include "../config.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); $result = mysql_db_query($database, "select * from $table WHERE username = '$username'") or die (mysql_error()); while ($qry = mysql_fetch_array($result)) { echo "$qry[email]"; } ?>" /> </p><p>Your website (URL):<br /> <input type="text" name="website" value="<?php include "../config.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); $result = mysql_db_query($database, "select * from $table WHERE username = '$username'") or die (mysql_error()); while ($qry = mysql_fetch_array($result)) { echo "$qry[website]"; } ?>" /> </p> <p> <input type="submit" name="Submit" value="Submit" /> </p></center> </form> pd; Please Help, Thanks Quote Link to comment https://forums.phpfreaks.com/topic/66573-a-mix-of-html-php-mysql-help/ Share on other sites More sharing options...
Jessica Posted August 24, 2007 Share Posted August 24, 2007 Well you have opening PHP tags inside your HEREDOC syntax. What you've written is pretty confusing. I think you need to clean it up, I personally never use HEREDOC. Just change it to: elseif ($getlink == "personalDetail") { //personal details changing ?> <u><b>Your Personal Details</b></u><br /> And then at the bottom remove: pd; No need for it here. Quote Link to comment https://forums.phpfreaks.com/topic/66573-a-mix-of-html-php-mysql-help/#findComment-333465 Share on other sites More sharing options...
rofl90 Posted August 24, 2007 Share Posted August 24, 2007 'Lame'z Downloads' Maybe you should be asking someone else, Mr hacker. Quote Link to comment https://forums.phpfreaks.com/topic/66573-a-mix-of-html-php-mysql-help/#findComment-333467 Share on other sites More sharing options...
lemmin Posted August 24, 2007 Share Posted August 24, 2007 You only need to connect to your database once, and, especially, only need to include the config file once. I think what jesirose said will fix your weird boxes. Quote Link to comment https://forums.phpfreaks.com/topic/66573-a-mix-of-html-php-mysql-help/#findComment-333470 Share on other sites More sharing options...
Lamez Posted August 24, 2007 Author Share Posted August 24, 2007 lol I have been meaning to take that out. Sorry Quote Link to comment https://forums.phpfreaks.com/topic/66573-a-mix-of-html-php-mysql-help/#findComment-333471 Share on other sites More sharing options...
rofl90 Posted August 24, 2007 Share Posted August 24, 2007 .. Why'd you make it in the first place? So you can BF things for fun? Quote Link to comment https://forums.phpfreaks.com/topic/66573-a-mix-of-html-php-mysql-help/#findComment-333472 Share on other sites More sharing options...
Neptunus Maris Posted August 24, 2007 Share Posted August 24, 2007 .. Why'd you make it in the first place? So you can BF things for fun? BF? ...??? Anyways yeah you shouldnt do things like this print <<<HERE while ($....) bla bla HERE; make sure the HERE; is fully tabbed to the left HERE; --right HERE; ---wrong and theres other things to this...im lazy right now Quote Link to comment https://forums.phpfreaks.com/topic/66573-a-mix-of-html-php-mysql-help/#findComment-333481 Share on other sites More sharing options...
Lamez Posted August 24, 2007 Author Share Posted August 24, 2007 here is my whole script, when I do what you told me to I get a error on line 123, which does not exist <!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=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="../../../style/default.css"/> <?php include ("../../../style/include/title.php"); ?> </head> <body> <div class="logo"><?php include ("../../../style/include/header.php"); ?></div> <div class="spacer"></div> <?php include ("../../../style/include/logged_menu_member.php"); ?> <div class="box"> <center><font size="3"> <?php //$username = $_COOKIE['loggedin']; //if (!isset($_COOKIE['loggedin'])) die("You are not logged in, <a href=../login.php>click here</a> to login."); //echo "<b>$username</b>'s Profile"; ?> </font></center></div> <div class="box"><font size="3"> <?php $getlink = $_GET["change"]; if ($getlink == "requestUsername") { //request username change echo "cody sucks"; } elseif ($getlink == "personalDetail") { //personal details changing print<<<pd <u><b>Your Personal Details</b></u><br /> <center><p>First Name: <br /> <input type="text" name="name1" value="<?php include "../../../../../config.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); $result = mysql_db_query($database, "select * from $table WHERE username = '$username'") or die (mysql_error()); while ($qry = mysql_fetch_array($result)) { echo "$qry[name1]"; } ?>" /> </p><p>Second Name: <br /> <input type="text" name="name2" value="<?php include "../../../config.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); $result = mysql_db_query($database, "select * from $table WHERE username = '$username'") or die (mysql_error()); while ($qry = mysql_fetch_array($result)) { echo "$qry[name2]"; } ?>" /> </p><p>Email Address: <br /> <input type="text" name="email" value="<?php include "../../../config.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); $result = mysql_db_query($database, "select * from $table WHERE username = '$username'") or die (mysql_error()); while ($qry = mysql_fetch_array($result)) { echo "$qry[email]"; } ?>" /> </p><p>Your website (URL):<br /> <input type="text" name="website" value="<?php include "../../../config.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); $result = mysql_db_query($database, "select * from $table WHERE username = '$username'") or die (mysql_error()); while ($qry = mysql_fetch_array($result)) { echo "$qry[website]"; } ?>" /> </p> <p> <input type="submit" name="Submit" value="Submit" /> </p></center> </form> pd; } elseif ($getlink == "password") { //password changing here print<<<pw <form action="update.php" method="post" ><p><u><b>Change your password</b></u><br /></p> <center><p> Old Password:<br /> <input type="password" name="oldpass" /> <br /> <br /> New Password: <br /> <input type="password" name="newpass" /> <br /> <br /> </p> <p> <input type="submit" name="Submit" value="Submit" /> </p></center> pw; } else { echo "PENIS FOR NOW"; } ?> </font></div> <?php include ("../../../style/include/footer.php"); ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/66573-a-mix-of-html-php-mysql-help/#findComment-333482 Share on other sites More sharing options...
deadimp Posted August 24, 2007 Share Posted August 24, 2007 Instead of having to embed your PHP in your heredoc literals to get the user info at that point, try getting it ahead of time to make things a little more aesthetic. Quote Link to comment https://forums.phpfreaks.com/topic/66573-a-mix-of-html-php-mysql-help/#findComment-333488 Share on other sites More sharing options...
rofl90 Posted August 24, 2007 Share Posted August 24, 2007 BF = Bruteforce Quote Link to comment https://forums.phpfreaks.com/topic/66573-a-mix-of-html-php-mysql-help/#findComment-333492 Share on other sites More sharing options...
Lamez Posted August 24, 2007 Author Share Posted August 24, 2007 I am lost in what you mean and no I do not go around BF things for fun. I have never hacked and never will. Quote Link to comment https://forums.phpfreaks.com/topic/66573-a-mix-of-html-php-mysql-help/#findComment-333496 Share on other sites More sharing options...
rofl90 Posted August 24, 2007 Share Posted August 24, 2007 So whys it on there. Quote Link to comment https://forums.phpfreaks.com/topic/66573-a-mix-of-html-php-mysql-help/#findComment-333498 Share on other sites More sharing options...
Neptunus Maris Posted August 24, 2007 Share Posted August 24, 2007 I am lost in what you mean and no I do not go around BF things for fun. I have never hacked and never will. ok.... ... anyways first dont do this print<<<pd do this print <<<PD space between the print and the <<< and use all caps for "pd" (PD) Quote Link to comment https://forums.phpfreaks.com/topic/66573-a-mix-of-html-php-mysql-help/#findComment-333499 Share on other sites More sharing options...
lemmin Posted August 24, 2007 Share Posted August 24, 2007 I am not familiar with printing html inside of php blocks, but one thing I know doesn't make sence is that you open a php block inside of a php block. For Example: <?php $getlink = $_GET["change"]; if ($getlink == "requestUsername") { //request username change echo "cody sucks"; } elseif ($getlink == "personalDetail") { //personal details changing print<<<pd <u><b>Your Personal Details</b></u><br /> <center><p>First Name: <br /> <input type="text" name="name1" value="<?php There is no closing of php, maybe this is because of the print method you are using, but it makes no sence to me. The error you are getting is something like "unexpected $end," right? This is because it has a open { somewhere without a }, usually. I would look through and try to find it, but I can't figure out your weird printing method. I would suggest changing your method to something more solid. For example, this: <?php $getlink = $_GET["change"]; if ($getlink == "requestUsername") { //request username change echo "cody sucks"; } elseif ($getlink == "personalDetail") { //personal details changing print<<<pd <u><b>Your Personal Details</b></u><br /> <center><p>First Name: <br /> <input type="text" name="name1" value="<?php include "../../../../../config.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); $result = mysql_db_query($database, "select * from $table WHERE username = '$username'") or die (mysql_error()); while ($qry = mysql_fetch_array($result)) { echo "$qry[name1]"; } ?> can be done like this: <?php $getlink = $_GET["change"]; if ($getlink == "requestUsername") { //request username change echo "cody sucks"; } elseif ($getlink == "personalDetail") { //personal details changing ?> <u><b>Your Personal Details</b></u><br /> <center><p>First Name: <br /> <?php $result = mysql_db_query($database, "select * from $table WHERE username = '$username'") or die (mysql_error()); $qry = mysql_fetch_array($result) echo "<input type=\"text\" name=\"name1\" value=\"" . $qry['name1'] . " />"; ?> I don't want to tell you how to write your code, but it would be a lot easier to find errors if it was a little simpler. Quote Link to comment https://forums.phpfreaks.com/topic/66573-a-mix-of-html-php-mysql-help/#findComment-333512 Share on other sites More sharing options...
Neptunus Maris Posted August 24, 2007 Share Posted August 24, 2007 I am not familiar with printing html inside of php blocks, but one thing I know doesn't make sence is that you open a php block inside of a php block. For Example: <?php $getlink = $_GET["change"]; if ($getlink == "requestUsername") { //request username change echo "cody sucks"; } elseif ($getlink == "personalDetail") { //personal details changing print<<<pd <u><b>Your Personal Details</b></u><br /> <center><p>First Name: <br /> <input type="text" name="name1" value="<?php There is no closing of php, maybe this is because of the print method you are using, but it makes no sence to me. The error you are getting is something like "unexpected $end," right? This is because it has a open { somewhere without a }, usually. I would look through and try to find it, but I can't figure out your weird printing method. I would suggest changing your method to something more solid. For example, this: <?php $getlink = $_GET["change"]; if ($getlink == "requestUsername") { //request username change echo "cody sucks"; } elseif ($getlink == "personalDetail") { //personal details changing print<<<pd <u><b>Your Personal Details</b></u><br /> <center><p>First Name: <br /> <input type="text" name="name1" value="<?php include "../../../../../config.php"; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); $result = mysql_db_query($database, "select * from $table WHERE username = '$username'") or die (mysql_error()); while ($qry = mysql_fetch_array($result)) { echo "$qry[name1]"; } ?> can be done like this: <?php $getlink = $_GET["change"]; if ($getlink == "requestUsername") { //request username change echo "cody sucks"; } elseif ($getlink == "personalDetail") { //personal details changing ?> <u><b>Your Personal Details</b></u><br /> <center><p>First Name: <br /> <?php $result = mysql_db_query($database, "select * from $table WHERE username = '$username'") or die (mysql_error()); $qry = mysql_fetch_array($result) echo "<input type=\"text\" name=\"name1\" value=\"" . $qry['name1'] . " />"; ?> I don't want to tell you how to write your code, but it would be a lot easier to find errors if it was a little simpler. put all printable data in variable form before printing it for HTML like: <?php $display = "Hello, I'm trying to figure this out."; ?> <html> <head> <title>The Page</title> </head> <body> <h3>The Page</h3> <p><?php print "$display"; ?></p> </body> </html> gives it a cleaner look Quote Link to comment https://forums.phpfreaks.com/topic/66573-a-mix-of-html-php-mysql-help/#findComment-333519 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.