Pesapal.com

Forum

Welcome, Guest
Username
Password:
 

default values for pesapal iframe.php
(1 viewing) (1) Guest
Welcome to the Pesapal integration forum!

This forum discusses everything about Pesapal integration on your web site. Having any problems? This is the right place to post a question and we are sure you will get an answer
  • Page:
  • 1

TOPIC: default values for pesapal iframe.php

default values for pesapal iframe.php 8 years, 5 months ago #2118

Hi Lazro and community,

If someone visits the /pesapal/iframe.php directly, they get an error such as unknown column in field list. I assume this is because there is no form data posted when you visit this page directly.

How can one define default values such that whether the form is filled or not, the database accepts the transaction and the iframe loads?

Re: default values for pesapal iframe.php 8 years, 5 months ago #2120

  • lazro
  • OFFLINE
  • Administrator
  • Pesapal
  • Posts: 404
Hello Unitanzania,


Just before storing the records and loading the iframe you can check if the variable has data, if not, set the default value. Have a look at the example below;

if(isset($_POST['amount']) && $_POST['amount']){
$amount = $_POST['amount'];
}else{
$amount = 1000;
}

This case simply be written as;

$amount = (isset($_POST['amount']) && $_POST['amount']) ? $_GET['amount'] : 1000;

This means if the post variable AMOUNT is set and has some value, pass the amount as the value posted. If the post variable is not set or the value is empty or 0, set the default as 1000
Regards,

Lazaro Ong'ele
Web Developer

Skype: Lazrotep
+254-020-249-5438 ; +254-706-191-729
Dagoretti Lane, Off Naivasha Road.

Facebook: www.facebook.com/pesapal
Twitter: twitter.com/PesaPal
Helpdesk: support.pesapal.com
This e-mail address is being protected from spambots. You need JavaScript enabled to view it.
  • Page:
  • 1