value of fom element not submittet

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
Tubbietoeter
Forum Contributor
Posts: 149
Joined: Fri Mar 14, 2003 2:41 am
Location: Germany

value of fom element not submittet

Post by Tubbietoeter »

Hi there,

I got a form containing some input fields and drop down menues. All of those values are submittet. however, the value of the buttons are not. i have more than one button and i want to know which one was klicked.

heres an example of what my script looks like:

<form action=page.php method=post>
<input type=text ....>
<input type=hidden ...>

<input type=button name=button1 value=button1 onClick=submit()>
<input type=button name=button2 value=button2 onClick=submit()>
<input type=button name=button3 value=button3 onClick=submit()>

</form>

So, all the values are in my _POST variables, except the buttons. how do i get those values?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

change them to type="submit" and please quote all properties of html elements ;)

Code: Select all

<input type="submit" name="button1" value="button1" />
Tubbietoeter
Forum Contributor
Posts: 149
Joined: Fri Mar 14, 2003 2:41 am
Location: Germany

Post by Tubbietoeter »

Thanks!
Stupid me should read the tutorials more closely ...


naa ... then I got to quote the quotes ... to lazy for that ... *fg* :lol:
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

using single-quoted strings in php there's no need to escape double-quotes, e.g.

Code: Select all

<?php 
$dqString = "<a href="whatever.html" > goto ...</a>";
$sqString = '<a href="whatever.html" > goto ...</a>';

$dqString = "<a href="$url" > goto ...</a>";
$sqString = '<a href="'. $url . '"> goto ...</a>';

print("<a href="$url" > goto ...</a>");
echo '<a href="', $url, '"> goto ...</a>';
?>
<a href="<?php echo $url; ?>"> goto ...</a>
You should not rely on the bonhomie of browsers to parse unquoted properties, it will retaliate sooner or later ;)
Post Reply