Page 1 of 1

form not posting data

Posted: Mon Oct 27, 2008 6:34 pm
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";
 

Re: form not posting data

Posted: Mon Oct 27, 2008 8:06 pm
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.

Re: form not posting data

Posted: Mon Oct 27, 2008 8:50 pm
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.

Re: form not posting data

Posted: Tue Oct 28, 2008 1:29 am
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 ;)

Re: form not posting data

Posted: Tue Oct 28, 2008 4:14 pm
by petethepirate
No that didnt fix it. The ' in the wrong place was a typo right?