Re: Re: posting information from a textarea

From: Date: Fri, 07 Jul 2006 01:03:46 +0000
Subject: Re: Re: posting information from a textarea
References: 1 2 3 4  Groups: php.db 
Request: Send a blank email to php-db+get-42181@lists.php.net to get a copy of this message
I'll show you all the steps it passes through. Here's the form: <form action="proc.php" method="post">
           <fieldset>
               <label for="Motto">Motto:</label>
               <input class="text" type="text" size="25" name="motto"
value="<?php if($form->value("motto") == ""){ echo $session->nationinfo['motto']; }else{ echo $form->value("motto"); } ?>" />
               <label for="desc">Nation Description:</label>
               <textarea name="desc" cols="50" rows="5"><?php
if($form->value("desc") == ""){ echo $session->nationinfo['desc']; }else{ echo $form->value("desc"); } ?></textarea> <input type="submit" value=" Edit Nation " />
        </fieldset>
</form> It's echoing the nationinfo right, but its not posting it. The motto also works too. When it's submitted, it goes through the function procEditNation(). $session->editNation($_POST['motto'], $_POST['desc']); The editNation function: function editNation($motto, $desc){
     global $database, $form;
     if($motto){
        $field = "motto";
        $motto = htmlspecialchars($motto);
        $database->updateNationField($this->username,"motto",$motto);
        }
     if($desc){
        $field = "desc";
        $desc = htmlspecialchars($desc);
        $database->updateNationField($this->username,"desc",$desc);
     }
     return true;
} Then finally the updateNationField function: function updateNationField($username, $field, $value){
     $q = "UPDATE nations SET ".$field." = '$value' WHERE username =
'$username'";
     return mysql_query($q, $this->connection);
} I just don't know what's wrong since it's posting the motto (which is just a text-type input) and not the description (which is a textarea). I echo'd out the mysql queries and excuted them myself from what echo'd out and it's selecting the desc column just fine. On 7/6/06, Chris <dmagick@gmail.com> wrote:
Dave W wrote: I saw this bug: http://bugs.php.net/bug.php?id=22427. Could this be related to problem I'm having? Actually, show us the form you're trying to submit before doing anything else. Since we haven't seen any html or php code, guessing it's a bug is a bit of a stretch. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- Dave W

« previous php.db (#42181) next »