Forum Moderators: coopster

Message Too Old, No Replies

Relieving values from a combo box

         

JuicyScript

9:01 pm on Mar 8, 2010 (gmt 0)

10+ Year Member



I have a combo box that populates it's options from the database.My problem is when i capture the values in the database it only captures the id and not the option name
This is my code

// Retreiving Form Elements from Form
$basic = addslashes($_REQUEST['state']);
$school = addslashes($_REQUEST['school']);

Matthew1980

9:09 pm on Mar 8, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there JuicyScript,

Pardon my ignorance to the rest of your code, but shouldn't the elements of the form be sent by $_POST, as that is what a form does - post's ($_POST) elements, & $_GETS for getting info from URLS.


$basic = addslashes($_POST['state']);
$school = addslashes($_POST['school']);


I know that $_REQUEST contains all the $_GET, $_POST & $_COOKIE, but from what I understand, when retrieving elements from a form, $_POST is the favoured method. Please correct me if I am wrong ;-p

Cheers,

MRb

JuicyScript

10:31 pm on Mar 8, 2010 (gmt 0)

10+ Year Member



You are ryt.But i've learnt to use $_request from the start so i just wanna stick to dat.Thanks anyway i waz able to solve the problem.

Readie

10:50 pm on Mar 8, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm under the impression that $_REQUEST takes more system resources to process than $_POST, $_GET or $_COOKIE.

Just because you have always done something does not mean it is a good way to do it. It's never too late to break the habit.

Matthew1980

8:29 am on Mar 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there JuicyScript,

It will take more system resources as it contains the array's for $_GET $_POST & $_COOKIE 'superglobals' in one request, thats why when you ask for $_POST, you are specifically asking for just the one array, and as array's take up more system resources it makes sense to go with the less memory intensive method of retrieval.

It would be a good method of practice if you were to use the $_POST way instead of the $_REQUEST, because if you are working as part of a team, you would want everyone in that team to work to the same conventions to stop confusion ;-p

Just my thoughts there, glad that you solved the issue in the end anyway, good luck with the rest of the project.

Cheers,

MRb