form not posting data

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
petethepirate
Forum Newbie
Posts: 10
Joined: Sat Oct 04, 2008 5:33 pm

form not posting data

Post by petethepirate »

For future reference, please enclose your php code within [ php] and [ /php] tags, to make it easier for us to read your code. (Omit the space after the bracket, I did that so they won't be parsed here.) Thanks.

I cant seem to get this form to post data. var_dump ($_POST) shows nothing. Ive tried every variation of this I can think of, and still nothing. Can anyone see what Im doing wrong? Thanks.

Code: Select all

 
    echo '<form id="myselectionz" method="POST" action="selectionchange.php'" name="myselection">'."\n";
    echo '<select name="myselection" class="tabletxt" onChange="this.form.submit()">'."\n";
        $ccurrentselection = substr($myselection, 4);
        $cccurrentselection = trim($myselection);
    echo '<OPTION SELECTED>'.$ccurrentselection.'';
 
    for ($i=0;$i<$j;$i++)
    {
        $dropfilehandle[$i] = rtrim($dropfilehandle[$i]);
        if ($dropfilehandle[$i] != $cccurrentselection && $i != 0)
        {
            $ccurrentselection = substr($dropfilehandle[$i], 4);
            echo '<OPTION value="'.$dropfilehandle[$i].'">'.$ccurrentselection.''."\n";
        }
    }
    echo '<OPTION value=" e">Erase this selection'."\n";
    echo '<OPTION value=" ">Add a new selection'."\n";
    echo '</SELECT>'."\n";
    echo '<value="send" method="post">'."\n";
    echo '</FORM>'."\n";
 
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: form not posting data

Post by califdon »

Have you tried it with a conventional Submit button? It looks like it should work with the javascript (unless it's disabled in the browser!), but since I've never used that, I can't say.

Edit: Oh, what's that line just before the </FORM>? I don't recognize that syntax.
petethepirate
Forum Newbie
Posts: 10
Joined: Sat Oct 04, 2008 5:33 pm

Re: form not posting data

Post by petethepirate »

A submit button would defeat the purpose of the list. The line before /form, trying different things. Ive been working on this one problem for about 3 days now, tried so many different variations of this to get it to work.
s-p-n
Forum Newbie
Posts: 1
Joined: Tue Oct 28, 2008 1:17 am

Re: form not posting data

Post by s-p-n »

Try this..

Code: Select all

 
echo '<form id="myselectionz" method="POST" action="selectionchange.php" name="myselection">'."\n";
echo '<select name="myselection" class="tabletxt" onChange="this.form.submit()">'."\n";
 
$ccurrentselection = substr($myselection, 4);
$cccurrentselection = trim($myselection);
 
echo '<OPTION name="'.$myselection.'" SELECTED=SELECTED>'.$ccurrentselection.'</option>'."\n";
 
for ($i=0;$i<$j;$i++)
 {
      $dropfilehandle[$i] = rtrim($dropfilehandle[$i]);
      if ($dropfilehandle[$i] != $cccurrentselection && $i != 0)
       {
            $ccurrentselection = substr($dropfilehandle[$i], 4);
            echo '<OPTION value="'.$dropfilehandle[$i].'">'.$ccurrentselection.'</option>'."\n";
       }
 }
 
echo '<OPTION value=" e">Erase this selection'.'</option>'."\n";
echo '<OPTION value=" ">Add a new selection'.'</option>'."\n";
echo '</SELECT>'."\n";
echo '<INPUT type="submit" value="Send" name="send">'."\n";
echo '</FORM>'."\n";
 
 
Hope this helps ;)
petethepirate
Forum Newbie
Posts: 10
Joined: Sat Oct 04, 2008 5:33 pm

Re: form not posting data

Post by petethepirate »

No that didnt fix it. The ' in the wrong place was a typo right?
Post Reply