$_FILES and $_POST in one parameter

Greetings! I know that $_POST, $_GET and $_FILES are different things, but is it possible to combine them $_post and $_file in java script? I want to validate the two user input in act_user.php.

am i doing right?


			
			parameters = 'fname='+document.getElementById('fname').value + '&' + 'lname='+document.getElementById('lname').value + '&' + 'id='+document.getElementById('stud_id').value+'&'+'gender='+document.getElementById('gender').value+'&'+'program='+document.getElementById('program').value+'&'+'file='+document.getElementById('file').value;
		
			xmlhttp.open('POST','FILE', 'act_user.php', true);
			xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
			xmlhttp.send(parameters);
			
			
	}

I have input text fname, lname, gender, program and id.

No, you cannot upload files to your server like this. ‘file=’+document.getElementById(‘file’).value will return nothing, as JavaScript isn’t allowed to access file inputs (I think). You’ll need to upload them the regular way, or using something like uploadify (http://www.uploadify.com/).

is there any way other than that?is it possible to put the same action in <form action= ‘validation.here’> and the same action found in js?

You could use an iframe and direct the form target to it as seen in the following demo http://css-tricks.com/snippets/html/post-data-to-an-iframe/

thank you the suggestions, I’m trying now the iframe, it really works like javascript except for the space covered by the iframes tag. is there any way to just append it using javascript?