Jump to content

[SOLVED] displaying data from $_GET in input field


Recommended Posts

Having trouble displaying data in an input field in Internet Explorer, Opera, and Apple Safari browsers but works fine in Firefox and Netscape.

The field is located in the websites shopping cart and gets its data via $_GET method when an item is added to the cart.

Any help as to why it wont display in IE at least would be greatly appreciated.

 

 

<input name="grand" type="text" id="grand" value="
<?php
if (($_GET['loc'] == "lcl") || ($ship_ref == 'lcl'))
{
echo '$'. ($grandTotal = number_format($totalCost, 2, ".", ","));
}
elseif (($_GET['loc'] == "nat") || ($ship_ref == 'nat'))
{
echo '$'. ($grandTotal = number_format($totalCost+4.50, 2, ".", ","));
}
elseif (($_GET['loc'] == "rul") || ($ship_ref == 'rul'))
{
echo '$'. ($grandTotal = number_format($totalCost+6.50, 2, ".", ","));
}
else
{
echo '$'. number_format($totalCost, 2, ".", ",");
} ?>" size="10" class="grandTotal" style="border:0pt none;" readonly />

 

 

IE shows <input name="grand" type="text" id="grand" value="$30.90" size="10" class="grandTotal" style="border:0pt none;" readonly />

so its there, I took out  class="grandTotal" style="border:0pt none;" readonly to see if that was it, but no, just displays an empty box in IE

 

FF shows <input name="grand" type="text" id="grand" value="$30.90" size="10" class="grandTotal" style="border:0pt none;" readonly /> and displays the value as expected.

Damn, just found the problem, it was because I had started the php on a new line....

doesnt work:

<input name="grand" type="text" id="grand" [b]value="
<?php[/b]
if (($_GET['loc'] == "lcl") || ($ship_ref == 'lcl'))
{

 

does work:

<input name="grand" type="text" id="grand" [b]value="<?php[/b]
if (($_GET['loc'] == "lcl") || ($ship_ref == 'lcl'))
{

 

someone slap me

 

Thanks for the help, sorry to have troubled you.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.