Goober
12-17-2003, 01:27 AM
how can i make a PHP file that will only accept "POST" commands in a form, from certian file(s)?
|
||||
PHP Forms QuestionGoober 12-17-2003, 01:27 AM how can i make a PHP file that will only accept "POST" commands in a form, from certian file(s)? DrWeb 12-17-2003, 02:04 AM <?php $request = $_SERVER['REQUEST_URI']; $method = $_SERVER['REQUEST_METHOD']; if ($request == '/myform.php' && $method == 'POST'){ .... } ?> Goober 12-17-2003, 03:05 AM thanks, but i have a couple more questions :D. in the if statement, are the two "&" symbols needed, or do you only need one? and why are there 2 "=" signs after $request and $method variables in the if statement? Spookster 12-17-2003, 03:49 AM It sounds like you have never programmed before nor used PHP. You might want to learn some of the basics of PHP and programming in general before you try to dive into anything difficult. && and == are operators. && is a logical operator that evaluates to true only if both sides of the expression evaluate to true. and == is a comparison operator that evaluates to true if both sides of the expression are equal. You might want to read through the manual http://us3.php.net/manual/en/ and maybe read through some beginning tutorials at www.zend.com Goober 12-17-2003, 06:43 AM naw i know the basics of php, and i've read through php.net, but i just can't remember everything cause im still new to this php thing. but thanks man :thumbsup: DrWeb 12-17-2003, 05:27 PM $request = $_SERVER['REQUEST_URI']; $method = $_SERVER['REQUEST_METHOD']; here we declare variables such as $request and $method and assign them to predefined server variables as described in http://www.php.net/manual/en/reserved.variables.php if ($request == '/myform.php' && $method == 'POST'){ .... } here we check if both of this variables are true after form has been submitted. If they are - proceed with whatever code you need. |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum