The14thGOD Posted September 5, 2007 Share Posted September 5, 2007 I'm really not sure how to use this...there doesn't seem to be much documentation here: http://www.php.net/manual/en/function.http-post-fields.php and I'm not familiar with this type of function. Could anyone give me a little help? Basically what I'm doing is taking a form, and then taking the values and pushing them into an array, then calculating cost, and then pushing values into an array to send out. Here is the code, as much as I can give at least. <?php import_request_variables('pg'); if($undefined_quantity) { $item_number.= "$undefined_quantity"; $item_name .= " x $undefined_quantity"; if($undefined_quantity < 20) { $amount = (8.00 * $undefined_quantity); }else if ($undefined_quantity > 20 and $undefined_quantity < 100) { $amount = (7.50 * $undefined_quantity); }else if ($undefined_quantity > 100 and $undefined_quantity < 250) { $amount = (7.00 * $undefined_quantity); }else if ($undefined_quantity > 250) { $amount = (6.25 * $undefined_quantity); }else if ($undefined_quantity == 0 or $undefined_quantity < 0) { header("Location: order_error.php"); exit(0); } $url = "website here"; $data = array($cmd,$business,$undefined_quantity,$item_name,$item_number,$amount,$currency_code,$lc,$bn); http_post_fields($url,$data); } ?> I guess what I really don't understand is how to use http_post_fields, do I use a header or something? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/67977-problem-with-http_post_fields/ Share on other sites More sharing options...
darkfreaks Posted September 5, 2007 Share Posted September 5, 2007 you need http_post_vars Quote Link to comment https://forums.phpfreaks.com/topic/67977-problem-with-http_post_fields/#findComment-341740 Share on other sites More sharing options...
The14thGOD Posted September 5, 2007 Author Share Posted September 5, 2007 It doesn't seem to be a function under php.net? theres a http_post_data? **edit** it also may help that it says fatal error: call to unidentified function Quote Link to comment https://forums.phpfreaks.com/topic/67977-problem-with-http_post_fields/#findComment-341741 Share on other sites More sharing options...
darkfreaks Posted September 5, 2007 Share Posted September 5, 2007 HTTP POST variables: $_POST Note: Introduced in 4.1.0. In earlier versions, use $HTTP_POST_VARS. An associative array of variables passed to the current script via the HTTP POST method. Automatically global in any scope. This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_POST; to access it within functions or methods, as you do with $HTTP_POST_VARS. $HTTP_POST_VARS contains the same initial information, but is not a superglobal. (Note that $HTTP_POST_VARS and $_POST are different variables and that PHP handles them as such) If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_POST and $HTTP_POST_VARS arrays. For related information, see the security chapter titled Using Register Globals. These individual globals are not superglobals. Quote Link to comment https://forums.phpfreaks.com/topic/67977-problem-with-http_post_fields/#findComment-341743 Share on other sites More sharing options...
darkfreaks Posted September 5, 2007 Share Posted September 5, 2007 also where does it define import_request_variables? is this a function? is so you need to include your function page so it recognizes it. Quote Link to comment https://forums.phpfreaks.com/topic/67977-problem-with-http_post_fields/#findComment-341744 Share on other sites More sharing options...
The14thGOD Posted September 5, 2007 Author Share Posted September 5, 2007 import_request_variables is a pre-defined function though php to basically pass the variables from the form to the script, granted if global variables is on you don't need it. could you please provide the link so that I can see some examples of how to use this function? I currently have an error: Fatal error: Function name must be a string in "file" on line 20 Quote Link to comment https://forums.phpfreaks.com/topic/67977-problem-with-http_post_fields/#findComment-341746 Share on other sites More sharing options...
darkfreaks Posted September 5, 2007 Share Posted September 5, 2007 http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=500&lngWId=8 Quote Link to comment https://forums.phpfreaks.com/topic/67977-problem-with-http_post_fields/#findComment-341747 Share on other sites More sharing options...
The14thGOD Posted September 5, 2007 Author Share Posted September 5, 2007 Ah, ty. But I don't think that is what I am looking for. The import_request_variables makes sure I have all of the variables as they are defined in the table. However, what I need to do with these variables is send them somewhere else so that it may process the variables. Basically it's going to paypal. But I need to define the price so that's why the form goes here so that it can calculate the final price and then send it. i could be mistaken but that's what it seems this function is doing. i could totally be in the wrong neighborhood too with my original direction. thanks for any help Quote Link to comment https://forums.phpfreaks.com/topic/67977-problem-with-http_post_fields/#findComment-341748 Share on other sites More sharing options...
darkfreaks Posted September 5, 2007 Share Posted September 5, 2007 found your problem and fix it for you. <?php $data = (array($cmd,$business,$undefined_quantity,$item_name,$item_number,$amount,$currency_code,$lc,$bn));?> also it cant be a variable if arrayed. it has to be a string like 'quantity' Quote Link to comment https://forums.phpfreaks.com/topic/67977-problem-with-http_post_fields/#findComment-341750 Share on other sites More sharing options...
darkfreaks Posted September 5, 2007 Share Posted September 5, 2007 to be honest your better off with $HTTP_POST_VARS Quote Link to comment https://forums.phpfreaks.com/topic/67977-problem-with-http_post_fields/#findComment-341756 Share on other sites More sharing options...
darkfreaks Posted September 5, 2007 Share Posted September 5, 2007 Simple Pyapal form: http://www.bigbiggeek.com/pages/paypaltutorial.html Quote Link to comment https://forums.phpfreaks.com/topic/67977-problem-with-http_post_fields/#findComment-341762 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.