Return to Snippet

Revision: 41931
at February 25, 2011 02:12 by aloncarmel


Initial Code
/**
	 * 
	 * Creates a form and posts all the data using javascript recieved to the url provided
	 * @param string $url
	 * @param string $postarray //Multi level array, array( array('fieldname','fieldvalue') )
	 */
	public function PostForward($url,$postarray=null)
	{
		
		$string = '<form method="post" name="form" action="'.$url.'">';
		
		if ($postarray != null) {
			
			foreach ($postarray as $postfield) {
				$string .= '<input type="text" name="'.$postfield[0].'" value="'.$postfield[1].'">';
				
			}
			
		}
		
		$string .= '</form>';
		$string .= '<script> document.form.submit();</script>';
		
		echo $string;
		exit;
		
	}

Initial URL
http://www.devunity.com

Initial Description

                                

Initial Title
Redirect post Data forward from code

Initial Tags

                                

Initial Language
PHP