This topic is locked
[SOLVED]

 Add To Cart Button

6/19/2013 8:58:30 AM
PHPRunner General questions
C
chrispa author

hi inspired from that
http://xlinesoft.com/phprunner/docs/inserting_button.htm
i have a button code as below
global $dal;
if ($keys["ID"])
{
//add new records to the ShoppingCart table
//save current username in the UserID field
$requsitions = $dal->Table("requsitions");
$requsitions->PartNo = $keys["ID"];
$requsitions->Add();
}
$result["txt"] = "Product was added";
IS WORKING FINE BUT IS IT POSSYBLY TO GET AND IMPORT ADDITIONAL FIELD VALUE TO THE TABLE REQUISITION AND NOT ONLY THE $KEYS["ID"] TO PARTNO?
FOR EXAMPLE USER BEFORE PRESS THE BUTTON CAN ENTER "ROB" NUMBER OF ITEMS FOR EXAMPLE 4
I WANT THAT NUMBER ENTERED I.E. 4 TO BE ALSO IMPORTED TO TABLE REQUISITION
SOMETHING LIKE THAT
$ShoppingCart->Quantity = 1;
BUT THE NUMBER IS CHANGING IS NOT CONSTAT DEPENDING THE VALUE ENTERED BY THE USER TO FIELD ROB .

C
cgphp 6/19/2013

In the "Before client" section you could use a javascript prompt box:

var number = prompt("Please enter a number","");
C
chrispa author 6/19/2013



In the "Before client" section you could use a javascript prompt box:

var number = prompt("Please enter a number","");



HI THANKS
on client before i add that
var number = prompt("Please enter a number","");

params["RFQ"] = number;
and on server that :
global $dal;
if ($keys["ID"])
{
//add new records to the ShoppingCart table
//save current username in the UserID field
$requsitions = $dal->Table("requsitions");
$requsitions->PartNo = $keys["ID"];
$requsitions->Add();
}
for ($i=0; $i<count($keys); $i++)

{

$sql = "Update requsitions set RFQ='".$params["RFQ"]."' where PartNo=" . $keys[$i]["ID"];

CustomQuery($sql);

}
$result["txt"] = "Product was added";
still cannot get RFQ to requsition table ????

C
cgphp 6/19/2013

Before client

var number = prompt("Please enter a number","");

params['number'] = number;



Server

$requsitions->ROB = $params['number'];


Remember to validate the number entered by the user.

C
chrispa author 6/19/2013



Before client

var number = prompt("Please enter a number","");

params['number'] = number;



Server

$requsitions->ROB = $params['number'];


Remember to validate the number entered by the user.


THANKS WORKING !!!
PLS CLARIFY WHAT YOU MEAN TO VALIDATE THE NUMBER ? THANKS

C
cgphp 6/19/2013

User could enter anything (not only numbers) in the prompt box.

Admin 6/19/2013

"Validate" means "check if entered value is actually the number and falls into some range" i.e. you should not allow entering any text there, do not accept negative numbers or numbers large than 1000 etc.
Read more about validation at http://xlinesoft.com/blog/2013/05/21/validation-in-phprunner-and-asprunnerpro-applications/

C
chrispa author 6/19/2013



"Validate" means "check if entered value is actually the number and falls into some range" i.e. you should not allow entering any text there, do not accept negative numbers or numbers large than 1000 etc.
Read more about validation at http://xlinesoft.com/blog/2013/05/21/validation-in-phprunner-and-asprunnerpro-applications/


ok thanks !!!