sesc
08-30-2007, 07:20 PM
I have a form with two fields. username , password. Also I have a file field where I can browse for a file. I have two buttons labeled 'Upload file' and 'Submit Form'. When I browse the file using file field and click on upload file button, the file needs to be moved to the directory in the server. then when I click on Submit form button after entering the username and password values, then these two values should be in to the database.
I am able to do these two actions independently. But where as when I mix these two I am unable to do this. Do I need to use two forms or one form is fine?. I am posting the code for one form that I am currently having.
Here is the form code:
<form name="submitFrm" method="post" enctype="multipart/form-data" action="<?=$_SERVER['PHP_SELF']?>">
username : <input name="usernm" type="text" size="30" maxlength="50" >
password : <input name="passwd" type="text" size="30" maxlength="50" >
Upload Img <input name="image" type="file" >
<input name="Upload" type="button" value="Upload " onClick="javascript:return upload_image();">
<input name="submit" type="button" value="Submit " onClick="javascript:return validate();">
</form>
should I have other php page for the 'action=' value. Please help me in getting this done. Thanks in advance. Please let me know if this is confusing?
I am able to do these two actions independently. But where as when I mix these two I am unable to do this. Do I need to use two forms or one form is fine?. I am posting the code for one form that I am currently having.
Here is the form code:
<form name="submitFrm" method="post" enctype="multipart/form-data" action="<?=$_SERVER['PHP_SELF']?>">
username : <input name="usernm" type="text" size="30" maxlength="50" >
password : <input name="passwd" type="text" size="30" maxlength="50" >
Upload Img <input name="image" type="file" >
<input name="Upload" type="button" value="Upload " onClick="javascript:return upload_image();">
<input name="submit" type="button" value="Submit " onClick="javascript:return validate();">
</form>
should I have other php page for the 'action=' value. Please help me in getting this done. Thanks in advance. Please let me know if this is confusing?