Page 1 of 1

Submit button doesn't work

Posted: Sat Oct 22, 2005 3:23 am
by BertR
feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


I don't see it. Can someone help me?
The submit button doesn't work.

Code: Select all

<?php
session_start();

function pulldown($count)
{
    if ($count > 0){
        echo "Children ".$count."<BR>";
    }
    for ($i = 0; $i != $count; $i++)
    {
        echo "Name <input type='text' name='name".$i."'> Age <input type='text' name='age".$i."'><BR>";
    }
}
?>
<form name="form0" method='post' action='<?$_SERVER['PHP_SELF'];?>'>


Surname                     :* <INPUT
                            TYPE="text"
                            NAME="surname"
                            SIZE="50"
                            MAXSIZE="50"
                            VALUE="<? echo $_POST['surname']; ?>"><BR>

<select onchange="form0.submit()" name="count">
<option>Children</option>
<option value='0'>0</option>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
</select>
<?php
echo "</form>";
echo "<form name='apply'>";
if ($_POST['count'] == ''){
    $_POST['count'] = 0;
}

pulldown($_POST['count']);

echo "<input type='submit' name='submit' value='Apply'>";
echo "</form>";

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Sat Oct 22, 2005 8:32 am
by feyd
how does your submit button "not work" ? The only thing I see that's quite wrong with your code is that your function is looking for $count, which doesn't exist to it.

Translate

Posted: Sat Oct 22, 2005 9:16 am
by BertR
Ok had to translate it from dutch

Forgot this

function pulldown($aantal) == function pulldown($count)

Posted: Sat Oct 22, 2005 9:18 am
by feyd
just noticed, your submit button is inside a different form from the combo box..

Otherwise errors

Posted: Sat Oct 22, 2005 9:21 am
by BertR
When they are in the same form I get errors

Posted: Sat Oct 22, 2005 9:26 am
by feyd
that's because you named your submit button submit. When you try to call the form's submit method, you're calling the submit button's object reference instead. Rename your submit button.

Ok

Posted: Sat Oct 22, 2005 9:29 am
by BertR
Ok thank you.

I have been working on it for 2 days.

That simple :oops: