SunQuest
           Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old December 22nd, 2002, 05:08 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
Simple problem with PHP and MySQL not populating corectly some of my forms...

Here is the deal, I want to be able to update the record through the form. So I want to populate the form first with the original data. Then the user sees the original content, modifies the entry in the form, and hits the update button, which in turn sends the update query to MySQL server....
Here is how it works...

$sql = mysql_query ("SELECT InvoiceNumber, FName, LName, Address, City, State, Zip, Tel, Email,
FROM customerdata,
WHERE InvoiceNumber LIKE '$snumber'");

$row = mysql_fetch_array($sql);
print "<form action="updatequery.php" method="post">";
do
{
print "<p>";
print "<font face="Century Gothic" size="2">Service Order#: </font>";
print "<input type="text" name="service" size=8 value=";
print $row['InvoiceNumber'];
print ">";
print "<font face="Century Gothic" size="2"> First name: </font>";
print "<input type="text" name="fname" size=15 value=";
print $row['FName'];
print ">";
print "<font face="Century Gothic" size="2"> Last name: </font>";
print "<input type="text" name="lname" size=15 value=";
print $row['LName'];
print "><br />";
print "<p>";
print "<font face="Century Gothic" size="2">Address: </font>";
print "<input type="text" name="address" size=14 value=";
print $row['Address'];
print " >";
print "<font face="Century Gothic" size="2"> City: </font>";
print "<input type="text" name="city" size=11 value=";
print $row["City"];
print ">";
print "<font face="Century Gothic" size="2"> State: </font>";
print "<input type="text" name="state" size=2 value=";
print $row["State"];
print ">";
print "<font face="Century Gothic" size="2"> Zip: </font>";
print "<input type="text" name="zip" size=4 value=";
print $row["Zip"];
print ">";
print "<font face="Century Gothic" size="2"> Tel#: </font>";
print "<input type="text" name="tel" size=9 value=";
print $row["Tel"];
print "><br />";
print "<p>";
print "<font face="Century Gothic" size="2">E-mail: </font>";
print "<input type="text" name="email" size=17 value=";
print print $row["Email"];
print ">";
print " <input type="submit" value="Update Record" /></form>";
} while ($row = mysql_fetch_array($sql));

OK, let me state that this code works, but not in 100%. The fields address and city are populated only partially.
Ie if the field "adress" has a value of "12345 Trigger St", only "12345" will show up in the form. This same applies to the field "city". The name of the city is "Ann Arbor", but only "Ann" will pop up in the form...?
Help,
What I am doing wrong?
The records in the database are setup to use varchar type. Maybe that is the problem?

Reply With Quote
  #2  
Old December 22nd, 2002, 05:51 AM
hermawan's Avatar
hermawan hermawan is offline
Superman is not dead
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Jakarta, Indonesia
Posts: 552 hermawan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 20 m 19 sec
Reputation Power: 2
Send a message via ICQ to hermawan Send a message via AIM to hermawan Send a message via Yahoo to hermawan Send a message via Google Talk to hermawan Send a message via Skype to hermawan
RE: Simple problem with PHP and MySQL not populating corectly some of my forms...

You must change all of your input, replace this one:
php Code:
Original - php Code
  1.  
  2. print "<input type="text" name="address" size=14 value=";
  3. print $row['Address'];
  4. print " >";

With this
php Code:
Original - php Code
  1.  
  2. print "<input type="text" name="address" size=14 value="";
  3. print $row['Address'];
  4. print "">";


Take a good look, and you'll see the different.

Reply With Quote
  #3  
Old December 22nd, 2002, 05:21 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Simple problem with PHP and MySQL not populating corectly some of my forms...

O'right!
Thanks a lot!!!!
Now I got it...

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Simple problem with PHP and MySQL not populating corectly some of my forms...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway