<?php
function strfrmto($st, $from, $to){
	
	return (substr($st, strpos($st, $from)+strlen($from), strpos($st, $to, strpos($st, $from)+strlen($from)) - (strpos($st, $from)+strlen($from))));

}


function makePostFields($postfieldnames, $postfieldvalues, $response){
	
	
	$postfields = "";
	
	foreach($postfieldvalues as $valkey => $valval){
		
		if(is_int($valval) && $valval==0){
			$postfieldvalues[$valkey] = strfrmto($response, $postfieldnames[$valkey].'" value="', '"');
			
		}
		
	}
	
	foreach($postfieldnames as $key => $val){
		
		$valweb = urlencode($postfieldvalues[$key]);
		$fieldweb = urlencode($val);
		$postfields = $postfields."&$fieldweb=$valweb";
		
	}
	$postfields = substr($postfields, 1);
	
	return $postfields;
}

?>