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
BertR
Forum Newbie
Posts: 11 Joined: Sat Oct 22, 2005 3:18 am
Location: Netherlands
Post
by BertR » Sat Oct 22, 2005 3:23 am
feyd | Please use 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
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Last edited by
BertR on Sat Oct 22, 2005 9:17 am, edited 1 time in total.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sat Oct 22, 2005 8:32 am
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.
BertR
Forum Newbie
Posts: 11 Joined: Sat Oct 22, 2005 3:18 am
Location: Netherlands
Post
by BertR » Sat Oct 22, 2005 9:16 am
Ok had to translate it from dutch
Forgot this
function pulldown($aantal) == function pulldown($count)
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sat Oct 22, 2005 9:18 am
just noticed, your submit button is inside a different form from the combo box..
BertR
Forum Newbie
Posts: 11 Joined: Sat Oct 22, 2005 3:18 am
Location: Netherlands
Post
by BertR » Sat Oct 22, 2005 9:21 am
When they are in the same form I get errors
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sat Oct 22, 2005 9:26 am
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.
BertR
Forum Newbie
Posts: 11 Joined: Sat Oct 22, 2005 3:18 am
Location: Netherlands
Post
by BertR » Sat Oct 22, 2005 9:29 am
Ok thank you.
I have been working on it for 2 days.
That simple