jrobles Posted December 23, 2009 Share Posted December 23, 2009 I am working on a credit card processing script and need to send the orderID to the payment gateway so the gateway can send the order id in the response page. my script uses an simple if statement if(FORM ISNT POSTED) {INSERT DATA INTO MYSQL TABLE(S)} else {SHOW FORM} In the form I can have a hidden field called oid (OrderID) How can I populate that value with what the order ID is going to be before I insert the records into the order table? I am pretty sure I have to have some code before the IF that will generate the next id from the table but Im not sure what the function is to do that. thanks Link to comment https://forums.phpfreaks.com/topic/186174-generating-order-id-before-entering-data/ Share on other sites More sharing options...
dflow Posted December 23, 2009 Share Posted December 23, 2009 from what i understand you should first layout your logical process for an order you can create : 1. create an insert form with initial order details request etc and submit 2. pass the GET the parameter by SELECT LAST_INSERT_ID();(the last inserted orderid if it's an orders_list to the hidden field Link to comment https://forums.phpfreaks.com/topic/186174-generating-order-id-before-entering-data/#findComment-983234 Share on other sites More sharing options...
nafetski Posted December 23, 2009 Share Posted December 23, 2009 Well you can still do the insert if you have the orderID, then when the form is generated you can just do... <input type="hidden" name="orderId" value ="<?php echo $orderID;?>" /> Hopefully that helps! Link to comment https://forums.phpfreaks.com/topic/186174-generating-order-id-before-entering-data/#findComment-983251 Share on other sites More sharing options...
jrobles Posted December 23, 2009 Author Share Posted December 23, 2009 thanks for your help guys, I think I figured it out. Happy holidays Link to comment https://forums.phpfreaks.com/topic/186174-generating-order-id-before-entering-data/#findComment-983308 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.