Results 1 to 3 of 3

Thread: updating data

  1. #1
    Join Date
    Nov 2005
    Posts
    40
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default updating data

    ok, i have a fairly simple program.
    http://www.newsalesparadigm.com/expe...clientlist.php

    http://www.newsalesparadigm.com/expe...lient.php?id=1

    As you can see, if anything besides "Comments" is more than one word, they don't show but the first word.
    PHP Code:
    <?php
              
    include 'config.php';
            include 
    'opendb.php'
            
            
    $sID $_GET['id'];
            
    $sSTEP $_GET['step'];
    ?>
    Some html here.

          <?php
          
            
    if(isset($_POST['add']))
            {
            
                
    $firstname $_POST['firstname'];
                
    $lastname $_POST['lastname'];
                
    $business $_POST['business'];
                
    $phone $_POST['phone'];
                
    $email $_POST['email'];
                
    $address $_POST['address'];
                
    $city $_POST['city'];
                
    $state $_POST['state'];
                
    $zip $_POST['zip'];
                
    $country $_POST['country'];
                
    $step $_POST['step'];
                
    $comments $_POST['comments'];
            
                
    $query "UPDATE clients SET firstname='$firstname', lastname='$lastname', business='$business', phone='$phone', email='$email', address='$address', city='$city', state='$state', zip='$zip', country='$country', step='$step', comments='$comments' WHERE id=$sID";
                
    mysql_query($query);
            }
            
                
    $query  "SELECT firstname, lastname, business, phone, email, address, city, state, zip, country, comments FROM clients WHERE id=$sID";
                
    $result mysql_query($query);
                
    $row mysql_fetch_array($result);
            include 
    'closedb.php';
            
            
    ?>
          <form method=post>
            <input name="firstname" type="text" id="firstname" value=<?php echo "{$row['firstname']}"?> size="13" />&nbsp;
            <input name="lastname" type="text" id="lastname" value=<?php echo "{$row['lastname']}"?> size="13" />
            <input name="business" type="text" id="business" value=<?php echo "{$row['business']}"?> size="33" />
            <input name="phone" type="text" id="phone" value=<?php echo "{$row['phone']}"?> size="33" />
            <input name="email" type="text" id="email" value=<?php echo "{$row['email']}"?> size="33" />
            <input name="address" type="text" id="address" value=<?php echo "{$row['address']}"?> size="33" />
            <input name="city" type="text" id="city" value=<?php echo "{$row['city']}"?> size="19" />&nbsp;
            <input name="state" type="text" id="state" value=<?php echo "{$row['state']}"?> size="7" />
            <input name="zip" type="text" id="zip" value=<?php echo "{$row['zip']}"?> size="13" />&nbsp;
            <input name="country" type="text" id="country" value=<?php echo "{$row['country']}"?> size="13" />
            <textarea name="comments" id="comments" cols="26" rows="4" wrap="virtual"><?php echo "{$row['comments']}"?></textarea>
            <br />
            <input name="add" id="add" type="submit" value="SAVE" />
             <?php
          
          
    if(isset($_POST['add']))
          {
              echo 
    "Updated";
          }
          
    ?>
                </form>

    MOD EDIT: Use [php] tags.
    Last edited by djr33; 03-05-2008 at 05:21 AM.

  2. #2
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    It took me a second to under stand the problem, but I think I get it.

    Change this:
    Code:
    <form method=post>
            <input name="firstname" type="text" id="firstname" value=<?php echo "{$row['firstname']}"; ?> size="13" />&nbsp;
            <input name="lastname" type="text" id="lastname" value=<?php echo "{$row['lastname']}"; ?> size="13" />
            <input name="business" type="text" id="business" value=<?php echo "{$row['business']}"; ?> size="33" />
            <input name="phone" type="text" id="phone" value=<?php echo "{$row['phone']}"; ?> size="33" />
            <input name="email" type="text" id="email" value=<?php echo "{$row['email']}"; ?> size="33" />
            <input name="address" type="text" id="address" value=<?php echo "{$row['address']}"; ?> size="33" />
            <input name="city" type="text" id="city" value=<?php echo "{$row['city']}"; ?> size="19" />&nbsp;
            <input name="state" type="text" id="state" value=<?php echo "{$row['state']}"; ?> size="7" />
            <input name="zip" type="text" id="zip" value=<?php echo "{$row['zip']}"; ?> size="13" />&nbsp;
            <input name="country" type="text" id="country" value=<?php echo "{$row['country']}"; ?> size="13" />
            <textarea name="comments" id="comments" cols="26" rows="4" wrap="virtual"><?php echo "{$row['comments']}"; ?></textarea>
            <br />
            <input name="add" id="add" type="submit" value="SAVE" />
    To this:
    Code:
    <form method="post">
            <input name="firstname" type="text" id="firstname" value="<?php echo "{$row['firstname']}"; ?>" size="13" />&nbsp;
            <input name="lastname" type="text" id="lastname" value="<?php echo "{$row['lastname']}"; ?>" size="13" />
            <input name="business" type="text" id="business" value="<?php echo "{$row['business']}"; ?>" size="33" />
            <input name="phone" type="text" id="phone" value="<?php echo "{$row['phone']}"; ?>" size="33" />
            <input name="email" type="text" id="email" value="<?php echo "{$row['email']}"; ?>" size="33" />
            <input name="address" type="text" id="address" value="<?php echo "{$row['address']}"; ?>" size="33" />
            <input name="city" type="text" id="city" value="<?php echo "{$row['city']}"; ?>" size="19" />&nbsp;
            <input name="state" type="text" id="state" value="<?php echo "{$row['state']}"; ?>" size="7" />
            <input name="zip" type="text" id="zip" value="<?php echo "{$row['zip']}"; ?>" size="13" />&nbsp;
            <input name="country" type="text" id="country" value="<?php echo "{$row['country']}"; ?>" size="13" />
            <textarea name="comments" id="comments" cols="26" rows="4" wrap="virtual"><?php echo "{$row['comments']}"; ?></textarea>
            <br />
            <input name="add" id="add" type="submit" value="SAVE" />
    The value needs to be placed in quotes (").
    Code:
    <input type="text" value=john smith>
    <!--the value is john; the tag thinks smith is another property//-->
    
    <input type="text" value="john smith">
    <!--the value is john smith//-->
    Last edited by Jas; 03-06-2008 at 02:13 AM.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  3. #3
    Join Date
    Nov 2005
    Posts
    40
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    thank you. This fixed it big time.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •