|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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] . ' ' . $accountsRow[3] . '<BR>'; echo $accountsRow[4] . ', ' . $accountsRow[5] . '  ' . $accountsRow[6 ] . '<BR>'; echo 'Phone:  ' .$accountsRow[7]; echo "</TH><TH>"; echo $accountsRow[9] . '<BR>'; echo 'Phone:  ' . $accountsRow[10] . '<BR>'; echo 'Email:  ' . $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> |
|
#2
|
|||
|
|||
|
RE: MySQL out put to a edit form
I think it cannot be happened except you have set a maxlength for text feilds.
|
|
#3
|
|||
|
|||
|
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.
|
|
#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!!
|
|
#5
|
|||
|
|||
|
RE: MySQL out put to a edit form
|
|
#6
|
|||
|
|||
|
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. |
|
#7
|
|||||
|
|||||
|
RE: MySQL out put to a edit form
The problem is in the "input type=text".
php Code:
example output: The first echo will print: Router Location The second will just print: Router |
|
#8
|
|||
|
|||
|
RE: MySQL out put to a edit form
I understood the first time you posted as anonymous... see my response to that post...
|
|
#9
|
|||
|
|||
|
RE: MySQL out put to a edit form
Your not so blind, Blindeddie. Thank you for your help and time.
Robert |
|
#10
|
|||
|
|||
|
RE: MySQL out put to a edit form
Glad to help anytime!!!
|
|
#11
|
|||
|
|||
|
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?
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > MySQL out put to a edit form |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|