Re: Re: posting information from a textarea

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think I might have found the problem, but I'm not sure how to fix it. I'm
just going to rebuild the form and it make it seperate (with all the
database calls in one page). For some reason, if I add another field before
the motto and i change it, it changes motto too...w/e I'll just make a new
one.

On 7/6/06, Dave W <dabbaking@xxxxxxxxx> wrote:

hmm..interesting. Neither the motto or desc is showing up in the array. I
made a simple form and the

echo 'post vars: ' . print_r($_POST, true) . '<br/>';

works fine. I'm just perplexed on why the motto is still working and not
the desc. Maybe it's because I'm using a fieldset, but then why wouldn't
just one not work?

On 7/6/06, Chris <dmagick@xxxxxxxxx> wrote:

> Dave W wrote:
> > 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.
>
> That definitely all looks fine.
>
> If you do:
>
> echo 'post vars: ' . print_r($_POST, true) . '<br/>';
>
> does it show up in post at all?
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>



--
Dave W




--
Dave W

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux