Vastzetten ge-POST variabele tot nieuwe wordt gepost.

Status
Niet open voor verdere reacties.

MrC67

Gebruiker
Lid geworden
21 jan 2011
Berichten
47
Hallo Forum,

Ik ben nog immer bezig met een iDEAL script, en deze doet weer eens niet wat ik wil.
Via een form POST ik een 3 tal variabelen naar dit script, waaronder bv. de variabele $amount, na de bankkeuze en druk op de knop betaal wordt even contact gemaakt met de bank en komt het weer terug in dit zelfde script ( tenminste als ik alles goed begrijp), maar dan bestaat de ge-POSTe variabele niet meer en kijg ik foutmeldingen dat die variabele niet aanwezig zijn, hoe is dit te ondervangen dat deze variabele vast blijven staan totdat nieuwe worden gepost??

Wederom Bedankt,

code:
PHP:
$amount      = ($_POST['amount']); 								
$description = ($_POST['description']);						
$returnURL   = ($_POST['returnURL']);	

//Settings

$Osci        = 0; 		# Accountnumber 
$amount      = ($_POST['amount']);							# Amount in cents (minimum of 84)
$description = ($_POST['description']);						# The description form the payment
$returnURL   = ($_POST['returnURL']);	                    # If the customer clicks on the "return to site" button it wil send him/her to this page
$reportURL   = 'http://www.mijnsite.nl/reportfrombank.php';	# This link is under water, no one will see this, but it always will be called from the 
																# bank zo you always can handle the payment (recommended for sending the confimationemail).

# The form has been send
if( $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['issuer']) && $_POST['issuer'] != '' ) { 

    $iDEAL = new OvasSolutionsIdeal( $Osci );
    $iDEAL->setIdealAmount( $amount );
    $iDEAL->setIdealDescription( $description );
    $iDEAL->setIdealissuer( $_POST['issuer'] );
    $iDEAL->setIdealReturnUrl( $returnURL );
    $iDEAL->setIdealReportUrl( $reportURL );
    
    $aPayment = $iDEAL->startPayment(); # Start of the payment
    $intTrxId = $aPayment[0]; 			# This is the transaction id
    $strBankURL = $aPayment[1]; 		# This will be the bank url that will rederect to the bank.
    header( "Location: ". $strBankURL );
}


# Handle the return from the bank
elseif( $_SERVER['REQUEST_METHOD'] != 'POST' && isset ( $_GET['ec'] ) && isset ( $_GET['trxid'] ) ) { 
    $iDEAL = new OvasSolutionsIdeal( $Osci );
    $status = $iDEAL->validatePayment ( $_GET['trxid'],1,1  );
    if( $status === true ) {
        echo 'The payment was succesful';   
    } 
    else {
        echo 'The payment was not (yet) succesful. Message: '. $status;   
    }  
}

# Show the form
else {
    ?>
    <form name="ideal" method="post">
        <table>
          <tr>
            <td>Bank</td>
            <td><select name="issuer"><script src="https://api.ovas.nl/ideal/issuers?lang=nl"></script></select></td>
          </tr>
          <tr>
            <td colspan="2" align="right"><input type="submit" value="Betaal"></td>
          </tr>
        </table>
    </form>    
    <?php    
}

?>
 
Laatst bewerkt door een moderator:
Ik weet niet zeker, maar ik dacht dat
header( "Location: ". $strBankURL );
een crul moet zijn, je ligt via de gegevens url contact met ideal en moet de gereturned info verder verwerken in je script.
 
Hey phobia,

crul ???? geen idee, wat je ziet is uit een bestaand script, wat bedoel je met crul??
 
doe dit eens:
PHP:
# Handle the return from the bank
elseif( $_SERVER['REQUEST_METHOD'] != 'POST' && isset ( $_GET['ec'] ) && isset ( $_GET['trxid'] ) ) { 
    echo '<pre>';
    print_r($_POST);// laat de POST array zien die door Ideal wordt terug gezonden
    echo '</pre>';
    $iDEAL = new OvasSolutionsIdeal( $Osci );
    $status = $iDEAL->validatePayment ( $_GET['trxid'],1,1  );
    if( $status === true ) {
        echo 'The payment was succesful';   
    } 
    else {
        echo 'The payment was not (yet) succesful. Message: '. $status;   
    }  
}
 
# Show the form

Als je nu een betaling doet dan komt je als ik het goed heb terug op de pagina waar je form staat. Maar nu moet er ook een hele lijst staan die Ideal via $_POST aan je terug gezonden heeft. Daar tussen zal denk ik al de gegevens staan die jij zoekt.
 
Hey phobia,

Aanpassing gedaan, krijg dit als enige return na het kiezen v/d bank en drukken op betaal/


Warning: Cannot modify header information - headers already sent by (output started at /

:o:confused:
 
hoe ziet je code er nu dan uit?
want wat ik er ingezet hebt geeft geen output als de header location gedaan word.
 
Als volgt;

# Settings
$Osci = 0; # Accountnumber
$amount = ($_POST['amount']); # Amount in cents (minimum of 84)
$description = ($_POST['description']); # The description form the payment
$returnURL = ($_POST['returnURL']); # If the customer clicks on the "return to site" button it wil send him/her to this page
$reportURL = 'http://www.mijnsite.nl/reportfrombank.php'; # This link is under water, no one will see this, but it always will be called from the
# bank zo you always can handle the payment (recommended for sending the confimationemail).

# The form has been send
if( $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['issuer']) && $_POST['issuer'] != '' ) {
echo '<pre>';
print_r($_POST);// laat de POST array zien die door Ideal wordt terug gezonden
echo '</pre>';


$iDEAL = new OvasSolutionsIdeal( $Osci );
$iDEAL->setIdealAmount( $amount );
$iDEAL->setIdealDescription( $description );
$iDEAL->setIdealissuer( $_POST['issuer'] );
$iDEAL->setIdealReturnUrl( $returnURL );
$iDEAL->setIdealReportUrl( $reportURL );

$aPayment = $iDEAL->startPayment(); # Start of the payment
$intTrxId = $aPayment[0]; # This is the transaction id
$strBankURL = $aPayment[1]; # This will be the bank url that will rederect to the bank.
header( "Location: ". $strBankURL );
}


# Handle the return from the bank
elseif( $_SERVER['REQUEST_METHOD'] != 'POST' && isset ( $_GET['ec'] ) && isset ( $_GET['trxid'] ) ) {
echo '<pre>';
print_r($_POST);// laat de POST array zien die door Ideal wordt terug gezonden
echo '</pre>';

$iDEAL = new OvasSolutionsIdeal( $Osci );
$status = $iDEAL->validatePayment ( $_GET['trxid'],1,1 );
if( $status === true ) {
echo 'The payment was succesful';
}
else {
echo 'The payment was not (yet) succesful. Message: '. $status;
}
}

# Show the form
else {
?>
<form name="ideal" method="post">
<table>
<tr>
<td>Bank</td>
<td><select name="issuer"><script src="https://api.ovas.nl/ideal/issuers?lang=nl"></script></select></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" value="Betaal"></td>
</tr>
</table>
</form>
<?php
}

?>
 
Volgens mij moet het zo werken.

PHP:
<?PHP
$amount      = ($_POST['amount']);                              
$description = ($_POST['description']);                     
$returnURL   = ($_POST['returnURL']);   
 
//Settings
 
$Osci        = 0;       // Accountnumber 
$amount      = ($_POST['amount']);                          //Amount in cents (minimum of 84)
$description = ($_POST['description']);                     //The description form the payment
$returnURL   = ($_POST['returnURL']);                       //If the customer clicks on the "return to site" button it wil send him/her to this page
$reportURL   = 'http://www.mijnsite.nl/reportfrombank.php'; //This link is under water, no one will see this, but it always will be called from the 
                                                                //bank zo you always can handle the payment (recommended for sending the confimationemail).
 
// The form has been send
if( $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['issuer']) && $_POST['issuer'] != '' ) { 
 
    $iDEAL = new OvasSolutionsIdeal( $Osci );
    $iDEAL->setIdealAmount( $amount );
    $iDEAL->setIdealDescription( $description );
    $iDEAL->setIdealissuer( $_POST['issuer'] );
    $iDEAL->setIdealReturnUrl( $returnURL );
    $iDEAL->setIdealReportUrl( $reportURL );
    
    $aPayment = $iDEAL->startPayment(); //Start of the payment
    $intTrxId = $aPayment[0];           //This is the transaction id
    $strBankURL = $aPayment[1];         //This will be the bank url that will rederect to the bank.
    header( "Location: ". $strBankURL );
}
// Handle the return from the bank
elseif( $_SERVER['REQUEST_METHOD'] != 'POST' && isset ( $_GET['ec'] ) && isset ( $_GET['trxid'] ) ) { 
    $iDEAL = new OvasSolutionsIdeal( $Osci );
    $status = $iDEAL->validatePayment ( $_GET['trxid'],1,1  );
    if( $status === true ) {
        echo 'The payment was succesful';
        echo '<pre>';
        print_r($_POST);// laat de POST array zien die door Ideal wordt terug gezonden
        echo '</pre>';
    } 
    else {
        echo 'The payment was not (yet) succesful. Message: '. $status;   
    }  
}
//Show the form
else {
    ?>
    <form name="ideal" method="post">
        <table>
          <tr>
            <td>Bank</td>
            <td><select name="issuer"><script src="https://api.ovas.nl/ideal/issuers?lang=nl"></script></select></td>
          </tr>
          <tr>
            <td colspan="2" align="right"><input type="submit" value="Betaal"></td>
          </tr>
        </table>
    </form>    
    <?php    
}
 
?>
 
Goedemorgen phobia,

Deze aanpassing getest, nu krijg ik niet meer die header melding maar kom ook niet bij de Bank keuze.

Als ik invoer bv. "Piet Janssen straat 18" en druk dan op "Nu betalen" geeft hij als resultaat: "Piet Janssen straat /18", druk ik dan nog een keer op "Nu betalen" komt er een / bij enz. enz.
 
heel vreemd, en als je het eerste script wat jij gepost hebt dan werkt het wel weer allemaal?
 
waar komt dat uit de lucht vallen
$iDEAL = new OvasSolutionsIdeal( $Osci );
include ?
 
Hey kenikavanbis,

Dat staat zo in het orginele iDEAL script, staat er 2x in, één keer bij (the form has been send) en één keer bij (handle geturn from bank).

@phobia,
Als ik onderstaande test dan werkt alles totdat ik weer die HEADER fout krijg.

nu vast ingevuld bij # settings
mijn accound nr: ( staat nu even op 0 )
$amount = 1750;
$description = 'test';
$returnURL= 'http://www.mijnsite.nl';
$reportURL = 'http://www.mijnsite.nl/reportfrombank.php';

de uiteindelijke opzet is om de var. $amount - $description en evt $returnURL bij elke betaling te kunnen wijzigen, dus een form POST deze variabele naar dit script die ze dan meeneemt in de verwerking, deze 3 heb ik bovenaan het script even uit ge-commenteerd.
dus op onderstaande code krijg ik: Warning: Cannot modify header information - headers already sent by (output started

code:

require_once ( 'OvasSolutionsIdeal.class.php');



//$amount = ($_POST['amount']);
//$description = ($_POST['description']);
//$returnURL = ($_POST['returnURL']);

//Settings

$Osci = 0; // Accountnumber
$amount = 1750; //Amount in cents (minimum of 84)
$description = 'test'; //The description form the payment
$returnURL = 'http://www.mijnsite.nl'; //If the customer clicks on the "return to site" button it wil send him/her to this page
$reportURL = 'http://www.mijnsite.nl/reportfrombank.php'; //This link is under water, no one will see this, but it always will be called from the
//bank zo you always can handle the payment (recommended for sending the confimationemail).

// The form has been send
if( $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['issuer']) && $_POST['issuer'] != '' ) {

$iDEAL = new OvasSolutionsIdeal( $Osci );
$iDEAL->setIdealAmount( $amount );
$iDEAL->setIdealDescription( $description );
$iDEAL->setIdealissuer( $_POST['issuer'] );
$iDEAL->setIdealReturnUrl( $returnURL );
$iDEAL->setIdealReportUrl( $reportURL );

$aPayment = $iDEAL->startPayment(); //Start of the payment
$intTrxId = $aPayment[0]; //This is the transaction id
$strBankURL = $aPayment[1]; //This will be the bank url that will rederect to the bank.
header( "Location: ". $strBankURL );
}
// Handle the return from the bank
elseif( $_SERVER['REQUEST_METHOD'] != 'POST' && isset ( $_GET['ec'] ) && isset ( $_GET['trxid'] ) ) {
$iDEAL = new OvasSolutionsIdeal( $Osci );
$status = $iDEAL->validatePayment ( $_GET['trxid'],1,1 );
if( $status === true ) {
echo 'The payment was succesful';

}
else {
echo 'The payment was not (yet) succesful. Message: '. $status;
}
}
//Show the form
else {
?>
<form name="ideal" method="post">
<table>
<tr>
<td>Bank</td>
<td><select name="issuer"><script src="https://api.ovas.nl/ideal/issuers?lang=nl"></script></select></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" value="Betaal"></td>
</tr>
</table>
</form>
<?php
}

?>
 
doe dit eens, en vertel wat je allemaal op je scherm ziet staan!
Als het goed is moet je na het verzenden van de betaling je scherm helemaal wit blijven. Of er verschijnen errors op je scherm.
PHP:
// error reporting, remove when going live
    error_reporting(E_ALL);
    ini_set('display_errors', '1');

$amount = 1750;
$description = 'test';
$returnURL = 'http://www.mijnsite.nl';
$reportURL = 'http://www.mijnsite.nl/reportfrombank.php';

/*
 de uiteindelijke opzet is om de var. $amount - $description en evt $returnURL bij elke betaling te kunnen wijzigen, dus een form POST deze variabele naar dit script die ze dan meeneemt in de verwerking, deze 3 heb ik bovenaan het script even uit ge-commenteerd.
dus op onderstaande code krijg ik: Warning: Cannot modify header information - headers already sent by (output started

code:
*/
require_once ( 'OvasSolutionsIdeal.class.php');



//$amount = ($_POST['amount']);
//$description = ($_POST['description']);
//$returnURL = ($_POST['returnURL']);
//Settings

$Osci = 0; // Accountnumber
$amount = 1750; //Amount in cents (minimum of 84)
$description = 'test'; //The description form the payment
$returnURL = 'http://www.mijnsite.nl'; //If the customer clicks on the "return to site" button it wil send him/her to this page
$reportURL = 'http://www.mijnsite.nl/reportfrombank.php'; //This link is under water, no one will see this, but it always will be called from the
//bank zo you always can handle the payment (recommended for sending the confimationemail).
// The form has been send
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['issuer']) && $_POST['issuer'] != '') {

    $iDEAL = new OvasSolutionsIdeal($Osci);
    $iDEAL->setIdealAmount($amount);
    $iDEAL->setIdealDescription($description);
    $iDEAL->setIdealissuer($_POST['issuer']);
    $iDEAL->setIdealReturnUrl($returnURL);
    $iDEAL->setIdealReportUrl($reportURL);

    $aPayment = $iDEAL->startPayment(); //Start of the payment
    $intTrxId = $aPayment[0]; //This is the transaction id
    $strBankURL = $aPayment[1]; //This will be the bank url that will rederect to the bank.
    exit();
    //header("Location: " . $strBankURL);
}
// Handle the return from the bank
elseif ($_SERVER['REQUEST_METHOD'] != 'POST' && isset($_GET['ec']) && isset($_GET['trxid'])) {
    $iDEAL = new OvasSolutionsIdeal($Osci);
    $status = $iDEAL->validatePayment($_GET['trxid'], 1, 1);
    if ($status === true) {
        echo 'The payment was succesful';
    } else {
        echo 'The payment was not (yet) succesful. Message: ' . $status;
    }
}
//Show the form
else {
    ?>
    <form name="ideal" method="post">
        <table>
            <tr>
                <td>Bank</td>
                <td><select name="issuer"><script src="https://api.ovas.nl/ideal/issuers?lang=nl"></script></select></td>
            </tr>
            <tr>
                <td colspan="2" align="right"><input type="submit" value="Betaal"></td>
            </tr>
        </table>
    </form>
    <?php
}
 
Hallo phobia,

Wijzigingen doorgevoerd, scherm blijft na invullen form en keuze bank & betaling geheel wit ( groen in mijn geval i.v.m. css) , maar er komen geen foutmeldingen op het scherm.
Krijg verder geen melding.

Fijne Jaarwisseling.
 
Jij ook de beste wensen en dat je scherm groen is verteld mij dat je het script op een verkeerde plek in je pagina laat inladen.
Want je hebt al een output naar je scherm gedaan...waardoor je een foutmelding krijgt door header().

Als je view source (bron van de pagina) bekijkt in je browser, dan moet die pagina ook helemaal leeg zijn. maar jij hebt al een head body en zo aangemaakt.
 
Laatst bewerkt:
Kon toch niet laten of even te kijken ( dan maar even geen oliebollen ), het script op de verkeerde plek inladen?? dat gaat me even boven mijn pet. kun je me uitleggen wat je hiermee bedoeld??

Alweer bedankt voor je moeite. ! :)
 
wat ik bedoel is dat je het het script voor je ideal betaling in een pagina via include of requere op je pagina laat weergeven.
Het script is zo ontworpen dat je via een link naar een aparte pagina wordt gestuurd.
 
Warning: Cannot modify header information - headers already sent by (output started

Dit wil betekenen dat uw header al is verstuurt dus moet je op een enter/space voor het <?php kijken en alles wat "ge prin"t of "ge echo t" wordt.
 
Hallo,

Probleem opgelost, zat een fout in form waardoor een variabele niet meegezonden werd, en die header fout werd gegenereerd door de CSS die als output gezien werd.

Dank aan jullie voor het meedenken. THX:thumb::thumb:
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan