Thread: Editing problem

    #1
  1. No Profile Picture
    The Dude Abides
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2000
    Location
    grass valley,ca
    Posts
    1,062
    Rep Power
    16
    Ok, here's the scoop. I have a script that allows you to edit the entries in the database. All is working fine except when you pull up an entry for editing the subject field only prints out the first word of the subject??? I know the entire subject line is in the database, but only this part of the script won't print it out. All the other fields work fine.

    Here is the part that doesn't seem to be working:

    case "edit":
    if ($submit)
    {
    $date = ($date);
    $subject = ($subject);
    $body = trim ($body);
    $body = addslashes ($body);

    mysql_query ("UPDATE articles SET date='$date', subject='$subject', body='$body' WHERE id='$id'");

    print ("Your news has successfully been edited!");
    }
    else {
    $result = mysql_query ("SELECT * FROM articles WHERE id='$id'");
    $row = mysql_fetch_array ($result);
    mysql_free_result ($result);

    $date = ($row["date"]);
    $subject = ($row["subject"]);
    $body = stripslashes ($row["body"]);
    ?>
    <html>
    <body bgcolor=#ffffff>
    <b>Edit News</b>
    <hr>
    <form method=post action=admin.php3?action=edit>
    <input type=hidden name=id value=<? echo $id; ?>>
    <table>
    <tr>
    <td valign=top>Date:</td>
    <td><input type=text name=date value=<? echo $date; ?>></td>
    </tr>
    <tr>
    <td valign=top>Subject:</td>
    <td><input type=text name=subject value=<? echo $subject; ?>></td>
    </tr>
    <tr>
    <td valign=top>Body:</td>
    <td><textarea name=body rows=12 cols=52 wrap=virtual><? echo $body; ?></textarea></td>
    </tr>
    <tr>
    <td></td>
    <td><input type=submit name=submit value=Edit></td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    <?
    }
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    You need "s around the value properties in your form tags.
  4. #3
  5. No Profile Picture
    The Dude Abides
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2000
    Location
    grass valley,ca
    Posts
    1,062
    Rep Power
    16
    HA! That worked like a champ. Here I was tearing through different parts of the script trying to add functions

    thanks
    chris

Similar Threads

  1. UTF-8 problem in 4.1.1a
    By mehran20 in forum MySQL Help
    Replies: 1
    Last Post: February 8th, 2004, 02:21 PM
  2. Wierd problem inserting data with VB6
    By gregquinn in forum MySQL Help
    Replies: 5
    Last Post: February 2nd, 2004, 07:37 AM
  3. WinNT4 problem
    By sandipguha in forum Windows Help
    Replies: 0
    Last Post: January 27th, 2004, 02:06 AM
  4. weird java problem..please help
    By suwandy in forum Java Help
    Replies: 1
    Last Post: January 26th, 2004, 04:13 AM
  5. mysql_fetch_array problem
    By njcallen in forum PHP Development
    Replies: 6
    Last Post: January 24th, 2004, 08:28 PM

IMN logo majestic logo threadwatch logo seochat tools logo