Jump to content

Not displaying :(


pure_skill_2000

Recommended Posts

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!

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.