Get and store rather than echo?!?

Hi there,

I need data from a MySQL database. But not display it.

I am trying to store some information before it is displayed.

I know how to display variables (ie. do a MySQL query and then echo the variables).

But how do I store the value on the page? Some I do not want to display (it is for a basket and I do not not want to display the customer email address but I do need to pass it to the card processing company).

So how do I just get, store or save the variable on the page rather than echo it?

Hope you know the answer!

Matt.

… put it in a variable instead of echoing it?

If it’s on the page, you’re echoing it… the only way to send information to the page is as content in the html… if it’s not something that should be sent client side, you shouldn’t be passing it in the page.

Well, there are cookies and sessions – I’d not use the former for something like a credit card number as that’s passed in the clear – session data isn’t passed client side, just the hash to tell the server what session it is… so that’s better.

Really though, it sounds like you’re either overthinking things or sending information client side that has no business client-side.

well - if a customer has just entered their email address when they get to the next page it will store it in the MySQL table, I DO NOT want to display it. But I do need to pass it to the card processing company. So I need to save/request it but not echo it. I need to request it from the MySQL Database. But I do not want to display it.

Matt.

Huh? That doesn’t make ANY sense…

I have a silly question, how does the credit card company in question say they want to receive it? I’d assume either as getData, postData, or as content in the request…

Sounds to me like you should put it in a hidden form field, but it depends on how the card processing company accepts payment requests from you.

Well a page on our server asks for the customers name, email, address, telephone number, etc.

Then on the next page (again on our server) it will save the data to a MySQL table!

Then on the next page it will GO TO THE PAYMENT COMPANY’S SERVER and they want all the info from us (name, email, address, telephone number, etc.) I do not want to display this information BUT I NEED TO SEND IT TO THEM - I plan to request the info but not display it - then i can send it to the processing company!

Our old basket used to be coded like this:


$ThisDescription="Online order from ActiveGPS.co.uk";
$ThisCustomerEmail= $_REQUEST['CustomerEmail'];
$ThisCustomerName= $_REQUEST['CustomerTitle']." ".$_REQUEST['CustomerName'];
$ThisDeliveryAddress= $_REQUEST['DeliveryAddress'];
$ThisDeliveryPostCode= $_REQUEST['DeliveryPostCode'];
$ThisBillingAddress= $_REQUEST['DeliveryAddress'];
$ThisBillingPostCode= $_REQUEST['DeliveryPostCode'];
// new 2.22 fields
$ThisContactNumber = $_REQUEST[ 'ContactNumber' ];
$ThisAllowGiftAid = $_REQUEST[ 'AllowGiftAid' ];
$ThisApplyAVSCV2 = $_REQUEST[ 'ApplyAVSCV2' ];
$ThisApply3DSecure = $_REQUEST[ 'Apply3DSecure' ];

This does not use a MySQL database. I need to do the same but NOW I AM USING A MYSQL database!

Do you understand?!

Matt.

How do THEY want to receive that information remains the question! You’re still not saying that… There’s only three ways of passing data – one of which stuffs it in the URL, one involves faking a form request and the third being to send them output… which means echo and/or it’s equivalents – that markup would NOT be sent to the client and SHOULD be sent via HTTPS.

oh - ok - now I understand what you need — the basket uses stuff code like this:

$stuff = "VendorTxCode=" . $ThisVendorTxCode . "&";
$stuff .= "Amount=" . $ThisAmount . "&";
$stuff .= "Currency=" . $ThisCurrency . "&";
$stuff .= "Description=" . $ThisDescription . "&";
$stuff .= "SuccessURL=" . $MyServer . "completed.php&";
$stuff .= "FailureURL=" . $MyServer . "notcompleted.php&";

if ($ThisCustomerEmail) {
  $stuff .= "CustomerEmail=" . $ThisCustomerEmail . "&";
}
if ($ThisCustomerName) {
  $stuff .= "CustomerName=" . $ThisCustomerName . "&";
}
if ($ThisDeliveryAddress) {
  $stuff .= "DeliveryAddress=" . $ThisDeliveryAddress . "&";
}
if ($ThisDeliveryPostCode) {
  $stuff .= "DeliveryPostCode=" . $ThisDeliveryPostCode . "&";
}
if ($ThisBillingAddress) {
  $stuff .= "BillingAddress=" . $ThisDeliveryAddress . "&";
}
if ($ThisBillingPostCode) {
  $stuff .= "BillingPostCode=" . $ThisDeliveryPostCode . "&";
}
// new 2.22 fields
if ($ThisContactNumber) {
  $stuff .= "ContactNumber=" . $ThisContactNumber . "&";
}


	$stuff .= "ApplyAVSCV2=" . $ThisApplyAVSCV2 . "&";
	$stuff .= "Apply3DSecure=" . $ThisApply3DSecure . "&";
	$stuff .= "eMailMessage=Thankyou for your order from activegps.co.uk, we will dispatch your goods shortly&";
	$stuff .= "Basket=$pdBasket";

If this cannot be done WITHOUT JAVASCRIPT I will NOT use this method!! So let me know this too, please!

Obviously, I need to get the info - and it is not all displayed (hence my question above).
Thanks,

Matt