[SOLVED]Getting Multiple POST Values

For Joomla! 1.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Locked
User avatar
knucklesmcfly
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Thu Jan 15, 2009 4:28 am

[SOLVED]Getting Multiple POST Values

Post by knucklesmcfly » Mon Jan 25, 2010 11:18 am

If I wanted to get a series of values from POST would I use multiple JRequest::getVar() methods like the example or is there another way?

Example:

Code: Select all

       $var1 = JRequest::getVar('var1');
		$var2 = JRequest::getVar('var2');		
		$var3 = JRequest::getVar('var3');		
Last edited by knucklesmcfly on Mon Jan 25, 2010 2:31 pm, edited 1 time in total.

 
User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 12510
Joined: Thu Feb 15, 2007 5:48 am
Location: Suzhou, China

Re: Getting Multiple POST Values

Post by toivo » Mon Jan 25, 2010 12:55 pm

That is the way. Remember to use the available methods like getInt to sanitize the user input: http://api.joomla.org/Joomla-Framework/ ... quest.html

To avoid errors, it is also useful to specify for example 'post', rather than accept the other sources like $_GET or $_COOKIE.
Toivo Talikka, Global Moderator

User avatar
knucklesmcfly
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Thu Jan 15, 2009 4:28 am

Re: Getting Multiple POST Values

Post by knucklesmcfly » Mon Jan 25, 2010 2:31 pm

Thanks and yes I figured that supplying all the arguments would be the safest way to do things.

Cheers.

 

Locked

Return to “Joomla! 1.5 Coding”