Jump to content

[SOLVED] showing $variable in form


herghost

Recommended Posts

can some one tell me why my variable $address1 is not showing in my form? What am I doing wrong?

 

<?php
session_start();
include('include/dbconfig.php');

$id = $_SESSION['id'];
?>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Welcome to JollyHosting</title>
    <link href="css/main.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
    var GB_ROOT_DIR = "script/";
</script>
<script type="text/javascript" src="script/AJS.js"></script>
<script type="text/javascript" src="script/AJS_fx.js"></script>
<script type="text/javascript" src="script/gb_scripts.js"></script>
<link href="script/gb_styles.css" rel="stylesheet" type="text/css" />



</head>
<?php
$sql = "SELECT * FROM users";
$result = mysql_query($sql ,$conn);
while($myrow = mysql_fetch_array($result))
{
$_SESSION['username'] = $myrow['username'];
}

$username = $_SESSION['username'];

$sql = "SELECT * FROM details WHERE id = $id";
$result = mysql_query($sql, $conn);
while($myrow = mysql_fetch_array($result))
{
$_SESSION['address1'] = $myrow['address1'];
$_SESSION['address2'] = $myrow['address2'];
$_SESSION['town'] = $myrow['town'];
$_SESSION['postcode'] = $myrow['postcode'];
$_SESSION['telephone'] = $myrow['telephone'];
}
//my inputs
$address1 = $_SESSION['address1'];
$address2 = $_SESSION['address2'];
$town = $_SESSION['town'];
$postcode = $_SESSION['postcode'];
$phone = $_SESSION['telephone']

?>
<body>
<div id="outerDiv">

    <div id="header">
        <div id="contactButton"><a href="contact.php" title="Contact Us" rel="gb_page_center[500, 500]"></a>
</div>
        <div id="mainMenu">
            <ul>    <!-- using the list here makes the nav nicely readable without CSS -->
                <li><a href="index.php" >Home</a></li>
                <li><a href="hosting.php">Hosting</a></li>
                <li><a href="backup.php">Backup</a></li>
                <li><a href="accounts.php" class="current">Account</a></li>
            </ul>
        </div> <!-- mainMenu -->
    </div> <!-- header -->

    <div id="midBanner">
        <img src="images/home_banner.jpg" width="770" height="90" alt="swells & vision" />
    </div>

    <div id="content">

<div id="mainContentfull">

            
<br>
<table width="100%" border="0">
  <tr>
    <td width="78%" height="97"><h1>Welcome Back <?php  echo "$username"; ?> </h1><br></td>
    <td width="22%"><img src="images/services.jpg" width="153" height="87" alt="services"></td>
  </tr>
</table>

<?php

echo "<table width='100%' border='0'>";
echo " <tr>";
echo "<td>";
echo $address1 ;
echo "</td>";
  echo "</tr>";
  
echo "</table>";
?>

</div> 
        <!-- mainContent -->

     
            <br>
        <p class="clear" />
    </div> <!-- content -->

</div> <!-- outerDiv -->

<?php

include('common/footer.php');

?>

</body>
</html>

 

Cheers

Link to comment
https://forums.phpfreaks.com/topic/174218-solved-showing-variable-in-form/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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