pure_skill_2000 Posted December 24, 2007 Share Posted December 24, 2007 Hi all, This code is the third part of an edit, it is working to pass user name onto this page well I presume it is as when I click submit its going onto the 2nd page. However the second page is just coming up with the header title and no info anyone got any ideas? Ive included the three files incase its in one of the others. Many thanks - its driving me loopy! ps, Merry Christmas! 1st file <form name="updateform" method="post" action="displayform.php"> <table width = "250" border="0" align-"center" cellpadding="3"> <tr> <td colspan="2" bgcolor="#dddddd" height="23"> <center><b>Enter your username</b></center> </td> </tr> <tr bgcolor="#eeeeee"> <td width="100" bgcolor="#eeeeee"> <center>username</center> </td> <td width="150"> <input type="text" name="username" /> </td> </tr> <tr> <td colspan="2" bgcolor="#dddddd"> <center> <Input type="submit" name="Submit" value="Submit" /> </center> </td> </tr> </table> </form> </body> </html> 2nd file $connection=mysql_connect ($host,$uname,$pass) or die ("Database connection failed! <br>"); $result=mysql_select_db ($database) or die ("Database could not be selected"); $query = "SELECT * FROM week9 WHERE username='" . $username . "'"; $result = mysql_query($query); if($row=mysql_fetch_array($result)) { echo " <tr bgcolor=\"#eeeeee\"> "; echo " <td width=\"100\" bgcolor=\"#eeeeee\"> "; echo " <div align=\"right\">password </div>"; echo " </td> "; echo " <td width=\"150\"> "; echo " <input type=\"text\" name=\"password\" value=\"",$row["password"]."\" > " ; echo " </td> "; echo " </tr> " ; echo " <tr bgcolor=\"#eeeeee\"> "; echo " <td width=\"100\" bgcolor=\"#eeeeee\"> " ; echo " <div alighn=\"right\">E-Mail</div>"; echo " </td>"; echo " <td width=\"150\"> "; echo " <input type=\"text\" name=\"email\" value=\"",$row["Email"]."\" > " ; echo " </td>"; echo " </tr>"; echo " <tr bgcolor=\"#eeeeee\"> "; echo " <td width=\"100\" bgcolor=\"#eeeeee\"> " ; echo " <div alighn=\"right\">USername</div>"; echo " </td>"; echo " <td width=\"150\"> "; echo " <input type=\"text\" name=\"username\" value=\"",$row["username"]."\" > " ; echo " </td>"; echo " </tr>"; echo " <tr>"; echo " <td colspan=\"2\" bgcolor=\"#dddddd\"> "; echo " <div align=\"center\"> " ; echo " <input type=\"submit\" name=\"Submit\" value=\"Submit\"> "; echo " </div> " ; echo " </td> " ; echo " </tr>"; } ?> </table> </form> </body> </html> File 3 $connection=mysql_connect ($host,$uname,$pass) or die ("Database connection failed! <br>"); $result=mysql_select_db ($database) or die ("Database could not be selected"); $query = "UPDATE week9 SET password=\"". $password . "\" , Email=\"". $Email . "\" where username=\"".$username. "\""; $result = mysql_query($query); if (!$result) { die(" Query could not be executed. <br>"); } else { echo " <table border=\"0\" align\"center\" cellspacing=\"1\" cellpadding=\"5\" width=\"300\">"; echo " <tr> " ; echo " <td colspan=\"2\" bgcolor=\"#dddddd\"> " ; echo " <center> <b> ".mysql_affected_rows()." record updated successfully </b> </center>" ; echo " </td> " ; echo " </tr> "; echo "<tr bgcolor=\"#eeeeee\"> "; echo " <td width=\"100\" bgcolor=\"#eeeeee\"> "; echo " <div align=\"right\">Name<\div>"; echo " </td> "; echo " <td width=\"200\">".$username. "<\td>"; echo "</tr>"; echo "<tr bgcolor=\"#eeeeee\"> "; echo " <td width=\"100\" bgcolor=\"#eeeeee\"> "; echo " <div align=\"right\">E-mail</div>"; echo " </td> "; echo " <td width=\"200\">".$Email. "</td>"; echo "</tr>"; echo "<tr bgcolor=\"#eeeeee\"> "; echo " <td width=\"100\" bgcolor=\"#eeeeee\"> "; echo " <div align=\"right\">Password</div>"; echo " </td>"; echo " <td width=\"200\">".$password. "</td>"; echo "</tr>"; echo "<tr> "; echo " <td colorspan=\"2\" bgcolor=\"#dddddd\"> </td>"; echo "</tr>"; echo "</table>"; } ?> </body> </html> Thanks again im hoping its something simple ive missed as the code took me awhile! Quote Link to comment https://forums.phpfreaks.com/topic/83083-not-displaying/ Share on other sites More sharing options...
thefollower Posted December 25, 2007 Share Posted December 25, 2007 If its coming from a form... on second file where is it "getting" the infomation? Example: $Username = $_POST['username']; That would then be holding the username from the "username" input box.. <input type="text" name="username" /> I don't see where your getting the information on the second file i just see a query.. but i could be just tired.. Quote Link to comment https://forums.phpfreaks.com/topic/83083-not-displaying/#findComment-422685 Share on other sites More sharing options...
pure_skill_2000 Posted December 25, 2007 Author Share Posted December 25, 2007 I think this may be the problem I thought it was just passed, what do I need to add and is it in the second file? Quote Link to comment https://forums.phpfreaks.com/topic/83083-not-displaying/#findComment-422692 Share on other sites More sharing options...
corbin Posted December 25, 2007 Share Posted December 25, 2007 3rd time I've posted these links today.... http://www.w3schools.com/php/php_get.asp http://www.w3schools.com/php/php_post.asp http://www.tizag.com/phpT/postget.php You're running into a script that thinks register globals is on.... If you don't know what I mean, Google 'php register global'. Quote Link to comment https://forums.phpfreaks.com/topic/83083-not-displaying/#findComment-422710 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.