Jump to content

Session Help


I-AM-OBODO

Recommended Posts

The truth is I have ran out of ideas and i am almost going bald cos of this. I will try to explain this as simple as i could.

I have various product which i represented by code(i.e lets say when a user types FOX in my form, i know what the FOX represents and so also the user) and these codes(i.e FOX) have different value assigned to them.

 

<?

$ProductCode = $_POST['ProductCode'];

  if ( $ProductCode == "Fox" ) {

    print "Your Product Choice is Fanta <br> Amount = 5000";

} elseif ( $ProductCode == "DECO" ) {

    print "Your Product Choice is Coke and Amount = 4000";

} elseif ( $ProductCode == "COD" ) {

    print "Your Product Choice is Pepsi and Amount = 3000";

} elseif ( $ProductCode == "CODEX" ) {

    print "Your Product Choice is Lemon and Amount = 2000";

} else {

  print "<b>YOUR PRODUCT ENTRY IS WRONG. CLICK BACK AND TRY AGAIN</b>";

}

?>

<?php echo $_SESSION['amount']; ?>

<? echo $_SESSION['trnxref']; ?>

 

I have transaction id for each transaction which is randomly generated and i want to parse both the transaction id and the amount to the payment page with these sessions.

 

<?php echo $_SESSION['amount']; ?>

<? echo $_SESSION['trnxref']; ?>

 

The transaction session, i've been able to pass, but the amount i could not pass, since i don't know how to convert the amount above into $amount variable so that it could be stored on the session for onward procession.

I want it as the above session cos its what the payment facility understands.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/119696-session-help/#findComment-619211
Share on other sites

First things first, if you want to use sessions, you need session_start(); at the top of your code.

 

Second, you try to echo $_SESSION['amount'] yet you never set it, same with 'trnxref'.

 

Third, don't mix short <? and <?php tags, just make them all <?php

Link to comment
https://forums.phpfreaks.com/topic/119696-session-help/#findComment-619223
Share on other sites

Thanks men.

But on my actual page, i did start the sessions. I have gotten a way of passing the sessions to another page, but the problem is, if u go thru this recent post i made, u will see that i have gone a little further. i just want to convert the amount to a variable so that it could go to a session. since it has different values but needs just one the $amount variable in order to parse to the next page, thats where am hanged.

hoping u understand

 

thnka alot

Link to comment
https://forums.phpfreaks.com/topic/119696-session-help/#findComment-619240
Share on other sites

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.