Forum Moderators: coopster

Message Too Old, No Replies

PHP & HTML working in FireFox but not IE

PHP & HTML working in FireFox but not IE

         

mandi_v

12:59 pm on Dec 5, 2007 (gmt 0)

10+ Year Member



Hey all, i wonder if some one can help me with this...
Maybe its something small, that i am missing.. any help would really be appreciated.

Right.. the following code works in firefox, you click the button and it takes you to the holiday-payment-insert.php page.

Now if you click it in IE, it just stays there, nothing happens..
Any ideas why?

Here is the code ----

<tr>
<td width="120">
<? echo "<a href='holiday-payment-insert.php?holidaysID=".$holidaysID."'">";?>
<input name="Insert" type="button" class="frmButton" id="Payment" value="Insert " />
<? echo "</a>";?></td>
</tr>

Again any help would really be appreciated!

hughie

2:19 pm on Dec 5, 2007 (gmt 0)

10+ Year Member



not sure but i'm also not sure of your structure

shouldn't it be

<tr>
<td width="120">
<a href='holiday-payment-insert.php?holidaysID=<?php echo $holidaysID;?>">
<input name="Insert" type="button" class="frmButton" id="Payment" value="Insert " />
</a></td>
</tr>

PHP_Chimp

2:55 pm on Dec 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you have multiple buttons on the form (other than submit and reset)?
As otherwise set the form action to "holiday-payment-insert.php?holidaysID=$holidaysID"
then use <input type="submit" value=...>

hughie

3:33 pm on Dec 5, 2007 (gmt 0)

10+ Year Member



just looking again, you done want an <a tag around a button.

use

<tr>
<td width="120">
<input name="Insert" type="button" class="frmButton" id="Payment" value="Insert " onclick="location.href='holiday-payment-insert.php?holidaysID=<?php echo $holidaysID;?>' /> </td>
</tr>

mandi_v

6:22 am on Dec 6, 2007 (gmt 0)

10+ Year Member



Thanks hughie

It works now.
But might i ask why you cannot put a <a href=''> around a button?

hughie

8:08 am on Dec 6, 2007 (gmt 0)

10+ Year Member



It's probably illegal HTML, it might work but it's certainly not good form.

mandi_v

9:04 am on Dec 6, 2007 (gmt 0)

10+ Year Member



Thanks for all your help

MakTheYak

2:28 pm on Dec 6, 2007 (gmt 0)

10+ Year Member



hughie is right - it is illegal HTML. A button is a form element and designed to work as part of a form.

While hughie's solution will work in many cases you should bear in mind that it uses javascript and therefore the button will simply not work in browsers with javascript turned off.

If you really need a form style button, I would urge you to use PHP_Chimp's solution which does not require javascript and will work in all browsers. If you don't, why not just use a straight <a> tag and style it up to look pretty with CSS?