One thing I see is that you need to put the following code snippet 
into the opening HTML <FORM> tag on the page where you are wanting 
to populate the fields from the database. There's a full version of 
how to do this just below the code snippet.

Try this...

<form name='updateform' action='' method='POST' 
enctype='multipart/form-data'>

Or, this...
(This form reads the data from the database, displays it in the form 
fields, and then when any of the data is changed and the submit 
button is clicked, the new or updated information is added to the 
database.) Good Luck!!!

        <html>
        <head>
        <title>Admin Area</title>
        <link rel="stylesheet" media="all" type="text/css" 
href="styles.css">
        <script language="JavaScript">
        function UpdateTarget(selectedValue)
        {
                var target = document.updateform.product1;
                target.value = selectedValue;
        }
        </script>
        </head>
        <body bgcolor="#666666">
        <?php
        include("connectmeinc.php");
        $connection = mysql_connect($host,$user,$password)
                or die ("Couldn't connect to server");
        $db = mysql_select_db($database,$connection)
                or die ("Couldn't select database");

        $partnerid = $_GET['partnerid'];

        /* Query that gets the reseller listings data and displays 
the
        number of partners results in a table (in ASCENDING ORDER). 
*/
        $query = "SELECT * FROM resellers INNER JOIN usa ON 
resellers.stateid = usa.stateid WHERE resellers.partnerid 
= '$partnerid'";
        $result = mysql_query($query)
                or die ("Couldn't execute query.");
                $nrows = mysql_num_rows($result);

                while ($row = mysql_fetch_array($result))
                {
                extract($row);
                echo "<form name='updateform' action='' 
method='POST' enctype='multipart/form-data'> 
        <table bgcolor='beige' align='center' width='400' border='4' 
bordercolor='#FFFFFF' cellpadding='10' cellspacing='0'>
                <tr>
                  <td align='right'>
                  <CENTER><font face='verdana' size='4'>Update 
Reseller's Profile Below...</font></CENTER><br>
                  <CENTER><font face='verdana' size='1'>[ <a 
class='navLightBlue' href='index.php'>Admin Home</a> | <a 
class='navLightBlue' href='viewpartners.php'>Edit / View USA</a> | 
<a class='navLightBlue' href='viewpartnerscan.php'>Edit / View 
Canada</a> | <a class='navLightBlue' href='news.php'>News</a> ]
</font></CENTER>
                  <br>
                   <b><font face='verdana' size='2' 
color='#0033CC'>Reseller's ID:</font>&nbsp;<font face='verdana' 
size='2' color='#CC0000'>$partnerid</font></b><font face='verdana' 
size='2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Reseller's 
Category:</b><br>
                                <br>
                                <a href='viewpartners.php'><img 
src='usflag.gif' valign='absmiddle' ALT='USA Resellers' 
border='0'></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;
                                <select name='oldcategory'>
                                <option value='$category' 
selected>$category
                                <option value='Retail Store'>Retail 
Store
                                <option value='Online Store'>Online 
Store
                                <option value='Wholesale 
Distributor'>Wholesale Distributor</select>
                                <br><br>
                                <b>Reseller's Business 
Information:</b><br><br>
                                Name of Business: <input type='text' 
size='25' name='oldbizname' value=\"$bizname\"><br>
                                Business Address: <input type='text' 
size='25' name='oldaddress' value=\"$address\"><br>
                                Address 2: <input type='text' 
size='25' name='oldaddress2' value=\"$address2\"><br>
                                City: <input type='text' size='25' 
name='oldcity' value=\"$city\"><br>
                                United States: <select 
name='oldstateid'>
                                 <option value='$stateid' 
selected>$statedesc
                 <option value='1'>Alabama
                 <option value='2'>Alaska
                 <option value='3'>Arizona
                 <option value='4'>Arkansas
                 <option value='5'>California
                 <option value='6'>Colorado
                 <option value='7'>Connecticut
                 <option value='8'>Delaware
                 <option value='9'>District of Columbia
                 <option value='10'>Florida
                 <option value='11'>Georgia
                 <option value='12'>Hawaii
                 <option value='13'>Idaho
                 <option value='14'>Illinois
                 <option value='15'>Indiana
                 <option value='16'>Iowa
                 <option value='17'>Kansas
                 <option value='18'>Kentucky
                 <option value='19'>Louisiana
                 <option value='20'>Maine
                 <option value='21'>Maryland
                 <option value='22'>Massachusetts
                 <option value='23'>Michigan
                 <option value='24'>Minnesota
                 <option value='25'>Mississippi
                 <option value='26'>Missouri
                 <option value='27'>Montana
                 <option value='28'>Nebraska
                 <option value='29'>Nevada
                 <option value='30'>New Hampshire
                 <option value='31'>New Jersey
                 <option value='32'>New Mexico
                 <option value='33'>New York
                 <option value='34'>North Carolina
                 <option value='35'>North Dakota
                 <option value='36'>Ohio
                 <option value='37'>Oklahoma
                 <option value='38'>Oregon
                 <option value='39'>Pennsylvania
                 <option value='40'>Rhode Island
                 <option value='41'>South Carolina
                 <option value='42'>South Dakota
                 <option value='43'>Tennessee
                 <option value='44'>Texas
                 <option value='45'>Utah
                 <option value='46'>Vermont
                 <option value='47'>Virginia
                 <option value='48'>Washington
                 <option value='49'>West Virginia
                 <option value='50'>Wisconsin
                 <option value='51'>Wyoming
                 </select><br>
                                Zip Code: <input type='text' 
size='13' name='oldzipcode' value='$zipcode' maxlength='10'><br>
                                Phone: (&nbsp;<input type='text' 
name='oldphonearea' value='$phonearea' size='3' maxlength='3'>&nbsp;)
&nbsp;<input type='text' name='oldphoneprefix' value='$phoneprefix' 
size='3' maxlength='3'>&nbsp;-&nbsp;<input type='text' 
name='oldphonesuffix' value='$phonesuffix' size='3' 
maxlength='4'><br>
                                E-mail: 
                                <input type='text' size='25' 
name='oldemail' value='$email'><br>
                                Web Address: <input type='text' 
size='25' name='oldwebaddress' value='$webaddress'><br><br>
                                <b>Which Products Will This Reseller 
Be Reselling?</b><br><br>
                                ThumbSaver: &raquo; <input 
type='text' size='25' name='oldproduct1' value='$product1'><br>
                                Framing Wizard: &raquo; <input 
type='text' size='25' name='oldproduct2' value='$product2'><br>
                                Tool Case: &raquo; <input 
type='text' size='25' name='oldproduct3' value='$product3'><br><br>
                                <b>Additional Products & Services 
Description:</b><br><br><textarea rows='5' cols='40' 
name='olddescription'>$description</textarea>
                                <input name='oldpasscode' 
type='hidden' value='$passcode'>
                                <br>
                        </font> 
    <br> 
    <input type='submit' name='Submit' value='Update Profile'>
    </td></tr></table></form>\n";
        }
        if(isset($_POST['Submit'])){
        //If the Submit button was pressed, do the following:
        $a = addslashes($_POST['oldcategory']);
        $b = addslashes($_POST['oldbizname']);
        $c = addslashes($_POST['oldaddress']);
        $d = addslashes($_POST['oldaddress2']);
        $e = addslashes($_POST['oldcity']);
        $f = $_POST['oldstateid'];
        $g = $_POST['oldzipcode'];
        $h = addslashes($_POST['oldemail']);
        $i = addslashes($_POST['oldwebaddress']);
        $j = $_POST['oldproduct1'];
        $k = $_POST['oldproduct2'];
        $l = $_POST['oldproduct3'];
        $m = addslashes($_POST['olddescription']);
        $n = $_POST['oldpasscode'];
        $o = $_POST['oldphonearea'];
        $p = $_POST['oldphoneprefix'];
        $q = $_POST['oldphonesuffix'];  
        //provinceid='$g', 
        $query2 = "UPDATE resellers SET category='$a', bizname='$b', 
address='$c', address2='$d',
                          city='$e', stateid='$f', zipcode='$g', 
email='$h', webaddress='$i', product1='$j',
                          product2='$k', product3='$l', 
description='$m', passcode='$n', phonearea='$o',
                          phoneprefix='$p', phonesuffix='$q' WHERE 
partnerid='$partnerid'";
        $results = mysql_query($query2)
              or die ("Could Not Make Desired Changes!");
        echo "<script language='javascript'>";
        echo "location.href='viewpartners.php#$partnerid';";
        echo "</script>";
        }

        ?>
        </body>
        </html>


I really can't see how else to help as a result of not being able to 
view the entire contents of your code. I hope this helps!

- William



--- In [email protected], "Grant Pollet" <[EMAIL PROTECTED]> 
wrote:
>
>  Hi,
> 
> I don't know if you're really new or not, but I am.  I have 
successfully
> created 2 basic forms: 1 is to add data to the database and the 
other is to
> retrieve. Look at my code and see if any of the functions or code 
give you a
> hint of what you need.
> 
> grant
> 
> HOW TO ADD DATA TO DATABASE.
> <?php
> @mysql_pconnect
> ("mysql35.secureserver.net", "username","password" )
> or die("My very first custom error message!");
> mysql_select_db("sellerlistings" ); ?></p>
> 
> <form action="entryform.php" method="post">
> <p>
> 
> HousesID:
> <input type="text" name="housesID" size="20" maxlength="40" 
value="" />
> </p>
> 
> <p>
> Bedrooms:<input type="text" name="bedrooms" size= "20" 
maxlength="40" value=
> "" />
> </p>
> 
> <p>
> Floors: <input type="text" name="floors" size= "20" maxlength="40" 
value=""/>
> </p>
> 
> <p>
> Baths:
> <input type="text" name="baths" size= "20" maxlength="40" 
value="" />
> </p>
> 
> <p>
> Fireplaces: <input type="text" name="fireplaces" size= "20" 
maxlength="40"value=
> "" />
> </p>
> 
> <p>
> Squarefeet: <input type="text" name="squarefeet" size= "20" 
maxlength="40"value=
> "" />
> </p>
> 
> <p>
> Price:
> <input type="text" name="price" size= "20" maxlength="40" 
value="" />
> </p>
> 
> <p>
> Yearbuilt:
> <input type="text" name="yearbuilt" size= "20" maxlength="40" 
value="" />
> </p>
> 
> <p>
> picture:
> <input type="text" name="picture" size= "20" maxlength="40" 
value="" />
> 
> </p>
> <input type="submit" name="submit" value="Go!"
> 
> $housesID=$_POST['housesID'];
> $bedrooms=$_POST['bedrooms'];
> $floors=$_POST['floors'];
> $baths=$_POST['baths'];
> $fireplaces=$_POST['fireplaces'];
> $squarefeet=$_POST['squarefeet'];
> $price=$_POST['price'];
> $yearbuilt=$_POST['yearbuilt'];
> $picture=$_POST['picture'];
> />
> 
> <?php
> 
> if (isset($_POST['submit']))
> 
> {
> 
> echo "<br />";
> 
> echo "House ID: ".$_POST['housesID']."<br />" ;
> echo "Bedrooms ".$_POST['bedrooms']." <BR />" ;
> echo "Floors " .$_POST['floors']." <BR />" ;
> echo "Baths ".$_POST['baths'] ." <BR />";
> echo "Fireplaces ".$_POST['fireplaces' ]." <BR />";
> echo "Squarefeet ".$_POST['squarefeet' ]." <BR />";
> echo "Price ".$_POST ['price']." <BR />";
> echo "Year Built " .$_POST['yearbuilt']." <BR />";
> 
> $query= "INSERT INTO tblhouses set HousesID='$housesID'
> ,Bedrooms='$bedrooms',
> Floors='$Floors', Baths='$baths' , fireplaces='$fireplaces' ,
> SquareFeet='$squarefeet' , Price='$price' , YearBuilt='$yearbuilt',
> Picture='$picture'" ;
> 
> $result = mysql_query($query);
> echo "Hey, dude...you're stuff has been added!". " <BR />" ;
> 
> }
> 
> ?>
> 
> <!................END OF PHP.........><!>
> 
>  </form>
> HOW TO RETRIEVE DATA FROM DATABASE
> 
> $link1= @mysql_pconnect
("mysql40.secureserver.net", "username","password");
> mysql_select_db("sellerlistings");
> 
> $query= SELECT housesID, bedrooms, floors, baths, 
fireplaces, ,squarefeet,
> price, yearbuilt, picture FROM tblhouses";
> 
> $result = mysql_query($query);
> 
> for ($count=0; $count < mysql_numrows($result); $count++)
> {
> $housesID = mysql_result($result, $count, "housesID");
> $bedrooms = mysql_result($result, $count, "bedrooms");
> $floors = mysql_result($result, $count, "floors");
> $baths = mysql_result($result, $count, "baths");
> $fireplaces = mysql_result($result, $count, "fireplaces");
> $squarefeet = mysql_result($result, $count, "squarefeet");
> $price = mysql_result($result, $count, "price");
> $yearbuilt = mysql_result($result, $count, "yearbuilt");
> $picture = mysql_result($result, $count, "picture");
> $fullpicture = "http://www.ricotierrarealty.com/images/"; . 
$picture;
> 
> echo "HouseID ($housesID) ";
> echo "Bedrooms: $bedrooms ";
> echo "Floors: $floors ";
> echo "Baths: $baths ";
> echo "Fireplaces: $fireplaces ";
> echo "Squarefeet: $squarefeet ";
> echo "Price: $price ";
> echo "Yearbuilt: $yearbuilt ";
> echo "Picture: $fullpicture ";
> echo "<br />";
> echo "<br />";
> echo "<p> </p>";
> 
> }
>  ?>
> 
> 
> [Non-text portions of this message have been removed]
>






The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to