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 September 22nd, 2003, 03:50 PM
rd42 rd42 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: peoria, IL, USA
Posts: 64 rd42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
MySQL out put to a edit form

I trying to autopopulate a form with information from a MySQL db, edit it, then resubmit it. When I create the default value for the text field, it just prints the first word of the string. If I echo just the value, it prints the full content. I've tried coding it several different ways, but I'm stumped.

The problem is down under the comment of Asset Listing


<HTML><BODY>
<link REL="stylesheet" TYPE="text/css" href="style1.css">
<form method="post" action="assetsql.php">

<?
require("db_connect.php");
require_once("inorout.php");
include_once("includes/header.php");

$acct = "SELECT * FROM accounts WHERE accid = $var";
$accountsResult = $db->query($acct);

$sql2 = "SELECT * FROM assets WHERE assetid = $var2";
$assetsResult = $db->query($sql2);

//Account Heading

echo "<table width="600" border="0" align="center" cellpadding="2" cellspacing="0" >";
while ($accountsRow = $accountsResult->fetchRow()) {
echo "<TR><TH>";
echo $accountsRow[1] . '<BR>';
echo $accountsRow[2] . '&nbsp' . $accountsRow[3] . '<BR>';
echo $accountsRow[4] . ',&nbsp' . $accountsRow[5] . '&nbsp&nbsp' . $accountsRow[6
] . '<BR>';
echo 'Phone:&nbsp&nbsp' .$accountsRow[7];
echo "</TH><TH>";
echo $accountsRow[9] . '<BR>';
echo 'Phone:&nbsp&nbsp' . $accountsRow[10] . '<BR>';
echo 'Email:&nbsp&nbsp' . $accountsRow[13];
echo "</TH></TR>";
}

echo "</table>";
echo "<BR><table width="600" border="0" align="center" cellpadding="2" cellspacing="0" >";
?>
<TR><TH>Edit Asset</TH></TR>
<?

while ($assetsRow = $assetsResult->fetchRow()) {
?>
\This works
echo $assetsRow[2];


<TR><TD>Asset Description:<BR> <input type=text name=description value=<? echo $assetsRow[2];?> size=40></td>
<?
\This doesn't
echo $assetsRow[2];
echo '<TR><TD>Content:<BR> <Textarea name=content rows=10 cols=40>' . $assetsRow[3] . '</TEXTAREA></TD></TR>';
}
?>
<TR><TD>
<input type="hidden" name="account" value="<?echo $var;?>">
<input type="hidden" name="asset" value="<? echo $var2;?>">
<input type="Submit" name="update" value="Update Asset">
</TR><TD>
</form>
</table>
</HTML>

Reply With Quote
  #2  
Old September 22nd, 2003, 03:56 PM
CodeKadiya CodeKadiya is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Colombo,Sri Lanka
Posts: 2,313 CodeKadiya User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
Send a message via Yahoo to CodeKadiya
RE: MySQL out put to a edit form

I think it cannot be happened except you have set a maxlength for text feilds.

Reply With Quote
  #3  
Old September 22nd, 2003, 05:06 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: MySQL out put to a edit form

I tried setting the length bigger, and no length at all. No luck. The value in the db is to 5 character words. It's strange how it will echo by itself, but in the text field only the first word.

Reply With Quote
  #4  
Old September 22nd, 2003, 05:37 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: MySQL out put to a edit form

Is it the textbox that displays the value of $assetsRow[2] or is it the textarea that displays the value of $assetsRow[3] that is giving you the problem? Let me know!! I think I know what the problem is if it is the textbox!!

Reply With Quote
  #5  
Old September 22nd, 2003, 06:17 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: MySQL out put to a edit form

The problem is in the "input type=text".

php Code:
Original - php Code
  1.  
  2. while ($assetsRow = $assetsResult->fetchRow()) {
  3. ?>
  4. \This works
  5. echo $assetsRow[2];
  6. \This doesn't
  7. <TR><TD>Asset Description:<BR> <input type=text name=description value=<? echo $assetsRow[2];?> size=40></td>
  8. ?>
  9. }

Reply With Quote
  #6  
Old September 22nd, 2003, 06:26 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: MySQL out put to a edit form

the problem is that you have not enclosed the value in quotes. I ran into this problem a while back in an app I was working on and enclosing the value in quotes fixed it. The tag should look like this...

<input type="text" name="description" value="<? echo $assetsRow[2];?>" size="40">

it is a good idead to try and enclose all the values of the input attributes with quotes.

Reply With Quote
  #7  
Old September 22nd, 2003, 06:26 PM
rd42 rd42 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: peoria, IL, USA
Posts: 64 rd42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: MySQL out put to a edit form

The problem is in the "input type=text".

php Code:
Original - php Code
  1.  
  2. while ($assetsRow = $assetsResult->fetchRow()) {
  3. ?>
  4. \This works
  5. echo $assetsRow[2];
  6. \This doesn't totally work.  It will print only the first word
  7. \in the string
  8. <TR><TD>Asset Description:<BR> <input type=text name=description value=<? echo $assetsRow[2];?> size=40></td>
  9. ?>
  10. }


example output:
The first echo will print: Router Location
The second will just print: Router

Reply With Quote
  #8  
Old September 22nd, 2003, 06:35 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: MySQL out put to a edit form

I understood the first time you posted as anonymous... see my response to that post...

Reply With Quote
  #9  
Old September 22nd, 2003, 07:47 PM
rd42 rd42 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: peoria, IL, USA
Posts: 64 rd42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: MySQL out put to a edit form

Your not so blind, Blindeddie. Thank you for your help and time.



Robert

Reply With Quote
  #10  
Old September 22nd, 2003, 08:27 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: MySQL out put to a edit form

Glad to help anytime!!!

Reply With Quote
  #11  
Old September 23rd, 2003, 11:55 AM
mdhall mdhall is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 158 mdhall User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: MySQL out put to a edit form

I had a similiar problem recently, however it was the textarea that I had trouble with. The text inputs displayed fine, but the textarea showed up either as a text input box with info, or showed up as a textarea box with nothing populating it. Whats the best way to do this?

Reply With Quote
  #12  
Old September 23rd, 2003, 12:00 PM
tkarkkainen's Avatar
tkarkkainen tkarkkainen is offline
Moderator
Click here for more information
 
Join Date: Apr 2007
Location: Finland
Posts: 2,320 tkarkkainen User rank is Lance Corporal (50 - 100 Reputation Level)tkarkkainen User rank is Lance Corporal (50 - 100 Reputation Level)tkarkkainen User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 11979 Folding Title: Novice Folder
Time spent in forums: 6 Days 8 h 50 m 37 sec
Reputation Power: 4
RE: MySQL out put to a edit form

mdhall:

php Code:
Original - php Code
  1.  
  2. <TEXTAREA><?php echo row[field]; ?></TEXTAREA>

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > MySQL out put to a edit form


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 |