so I want to view the contents of $HTTP_GET_VARS VARIABLE.
if I type
echo ($HTTP_GET_VARS)
i get the rsponse "array"
how do I view this array?
so I want to view the contents of $HTTP_GET_VARS VARIABLE.
if I type
echo ($HTTP_GET_VARS)
i get the rsponse "array"
how do I view this array?
Try print_r($HTTP_GET_VARS);
I still get "Array"
Use the [man]foreach[/man] function, like this:
foreach($HTTP_GET_VARS as $key => $val)
{
echo $key.' -> '.$val.'<br>';
}
Or do it like this:
while(list($key,$val) = each($HTTP_GET_VARS))
{
echo $key.' -> '.$val.'<br>';
}
it still doesn't work.
So I'm trying to simplify the command by trying to access one of the variables in a simple code
//if filled out
if ($ship_country)
{echo it's here;}
else{echo it's not here;}
but I keep getting error messages.
I'm getting nowhere with this.
Been working on it all day and I'm about to loose my mind
If you don't want to use the results in a script, just view them, you might give this a try:
<?php
echo phpinfo();
?>
Unless you have a really long GET string, you could just look at your address bar.
Since GET variables are global, and you had to create the GET string in the first place, it shouldn't be too hard to figure out what's in there.
If you want to use the data, just use the variables you put there.
the only thing I want to do, which shouldn't be very difficult is to view the array cretaed by a form using action "get" on the following page.
So far noone has been able to help me.
then you could do like this:
<pre>
<?php
print_r($_GET); // or $HTTP_GET_VARS
?>
</pre>
or maybe
array_values($HTTP_POST_VARS);
and if that doesn't work, you could always try to put print_r() AROUND the array values, that should work?
first of all none of the above examples worked, though I appreciate th help.
MY get command get's info from the UPS server.
It also uses javascript to display the information.
Here's the code of the function within which the get command lay:
function display_shipping_form()
{
?>
<script language="javascript" type="text/javascript">
<!--
function set_ups_rate(rate)
{
document.checkout.elements['ups_rate'].value = rate;
document.checkout.elements['show_ups_rate'].value = rate;
}
function ups_winOpen(){
width= "300";
height="200";
optionString = "scrollbars=yes,status=yes,menubar=no,resizable=yes,location=no,toolbar=no,width=" + width + ",height=" + height;
var country = document.checkout.elements.ship_country.options[document.checkout.elements.ship_country.selectedIndex].value;
var zip = document.checkout.elements['ship_zipcode'].value;
var ServiceLevelCode = document.checkout.elements.ServiceLevelCode.options[document.checkout.elements.ServiceLevelCode.selectedIndex].value;
var weight = document.checkout.elements['weight'].value;
if(ServiceLevelCode ==""){
alert("Please select Shipping Service.");
document.checkout.elements.ServiceLevelCode.focus();
return false;
}
if(country ==""){
alert("Please select ship-to Country.");
document.checkout.elements.ship_country.focus();
return false;
}
if(zip == ""){
alert("Please select ship-to ZipCode.");
document.checkout.elements.ship_zipcode.focus();
return false;
}
self.name = "opener";
var es_zip = escape(zip);
var es_country = escape(country);
var es_weight = escape(weight);
var es_service = escape(ServiceLevelCode);
var action = "ups.php?zip=" + es_zip + '&country=' + es_country + '&service=' + es_service + '&weight=' + es_weight;
cartWindow = window.open(action,'cart',optionString);
return true;
}
// -->
</script>
<STYLE type=text/css>
SELECT { color: #BA8C5D; font-size: 9px; font-family: Verdana, Helvetica, Arial, Sans-serif; background-color: #fff }
TD { font-size: 11px; font-family: Verdana, Helvetica, Arial, Sans-serif}
P { font-size: 11px; line-height:16px; font-family: Verdana, Helvetica, Arial, Sans-serif}
.othertext {font-size:11px; font-family:verdana,arial,helvetica,sans-serif}
td.dark { color: #fff; font-weight: bold; background-color: #000099 }
td.content { background-color: white}
td.scrollbar-face-color: #FECB66;
td.scrollbar-shadow-color: #FFA500;
td.scrollbar-highlight-color: #FFA500;
td.scrollbar-3dlight-color: #FFFFFF;
td.scrollbar-darkshadow-color: #000000;
td.scrollbar-track-color: #E2DAD1;
td.scrollbar-arrow-color: #000000;
</STYLE>
<form method="get" name="checkout" >
<input type="hidden" name="ups_rate">
<table class="dark" width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="1">
<tr>
<td class="dark" colspan="2" align="center"><b>Shipping Address</b></td>
</tr>
<tr>
<td class="content" width="27%"><b><label for="ship_country">Country:*</label></b></td>
<td class="content"><span class="smalltext">We ship to the following countries:</span><br>
<select id="ship_country" name="ship_country" size="1">
<option value="">--Select Ship-to Country--</option>
<OPTION VALUE="AL">ALBANIA</OPTION>
<OPTION VALUE="ZW">ZIMBABWE</OPTION>
</select>
<br>
</td>
</tr>
<tr>
<td class="content" width="27%"><b><label for="ship_zipcode">Zip Code:*</label></b></td>
<td class="content"><input id="ship_zipcode" type="text" name="ship_zipcode" value="44444" size="15" maxlength="20"></td>
</tr>
<tr>
<td class="content" width="27%"><b><label for="weight">Package Weight:*</label></b></td>
<td class="content"><input id="weight" type="text" name="weight" value="2.00" size="10" maxlength="10"></td>
</tr>
<!--START_SHIPPING_CONTENTS-->
<tr>
<td class="content"><b>Select Shipping Service:*</b></td>
<td class="content">
<SELECT NAME = "ServiceLevelCode">
<OPTION VALUE = "">Select Shipping Service
<OPTION VALUE = "1DM">UPS Next Day Early AM
<OPTION VALUE = "1DA">UPS Next Day Air
<OPTION VALUE = "1DML">UPS Next Day Early AM Letter
<OPTION VALUE = "1DAL">UPS Next Day Air Letter
<OPTION VALUE = "1DAPI">UPS Next Day Air Intra (Puerto Rico)
<OPTION VALUE = "1DP">UPS Next Day Air Saver
<OPTION VALUE = "1DPL">UPS Next Day Air Saver Letter
<OPTION VALUE = "2DM">UPS 2nd Day Air AM
<OPTION VALUE = "2DA">UPS 2nd Day Air
<OPTION VALUE = "2DML">UPS 2nd Day Air AM Letter
<OPTION VALUE = "2DAL">UPS 2nd Day Air Letter
<OPTION VALUE = "3DS">UPS 3 Day Select
<OPTION VALUE = "GNDRES">UPS Ground Residential
<OPTION VALUE = "GNDCOM">UPS Ground Commercial
<OPTION VALUE = "STD">UPS Canada Standard
<OPTION VALUE = "XPR">UPS Worldwide Express
<OPTION VALUE = "XDM">UPS Worldwide Express Plus
<OPTION VALUE = "XPD">UPS Worldwide Expedited
<OPTION VALUE = "XPRL">UPS Worldwide Express Letter
<OPTION VALUE = "XDML">UPS Worldwide Express Plus Letter
</select>
</td>
</tr>
<!--END_SHIPPING_CONTENTS-->
<tr>
<td class="content" width="27%"><b><label for="show_ups_rate">Shipping Fee:</label></b></td>
<td class="content">$<input id="show_ups_rate" type="text" name="show_ups_rate" value="" size="8" readonly></td>
</tr>
<tr>
<td class="content" width="27%"><br>
</td>
<td class="content"><input type="button" name="action" value="Check Shipping Cost" onClick="ups_winOpen();">
</tr>
</table>
</td>
</tr>
</table>
<?
}
?>
so how do I get the information out of this form?
well, I don't think that you can access these get variables if your form hasn't been submitted.
to enable this, you'll have to add action="yourfile.php" in the form tag.
Originally posted by rIkLuNd
well, I don't think that you can access these get variables if your form hasn't been submitted.
to enable this, you'll have to add action="yourfile.php" in the form tag.
It doesn't matter because he uses a JavaScript function to send variables and values.
Like Digimatt suggested it, if you try phpinfo(), does it shows the contents of $_GET ?
oh sorry... didn't know that...
I even added action="purchse.php"
I guess it's the javascript.
Can anyone tell me how can access these variables?
for procesing? The only one I really need is the cost.