|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
checkbox and file values in forms
I'm reasonably confident this is an html issue not a php issue, but I could be wrong. If it is an html problem, this is what it is:
When I send data from two forms, a text area and a series of checkboxes, to a new page, I can access the values of both through $_POST[] in php. I then submit the text area contents to each database that was selected in the check boxes. When I try to do exactly the same thing with a form that selects and sends a file and a form that has series of checkboxes, the check boxes' values are never set. This is what works <form action="811updateeng.php" method="POST"/> <textarea name= "hwtext" rows="10" cols="50" wrap> </textarea><br /><br /> <input type="submit" value"GO"> <form name="form1" method="post" action="811updateeng.php"> 811 <input type="checkbox" name="811" value="checkbox"> 813 <input type="checkbox" name="813" value="checkbox"> </form> This is what doesn't work: <form name="form2" method="POST" action="myupload.php"> 811 <input type="checkbox" name="811" value="checkbox"> 813 <input type="checkbox" name="813" value="checkbox"> </form> <form enctype="multipart/form-data" action="myupload.php" method="post"> Send this file: <input name="userfile" type="file" /> <input type="submit" value="Send File" /> </form> I've futzed around with this, but can't make it work. I'm figuring that the file type is somehow unsetting the value of my checkboxes??? I really have no idea, and appreciate any advice. |
|
#2
|
|||
|
|||
|
RE: checkbox and file values in forms
You can't get the selected file using $_POST[] superglobal. You got to have $_FILES[]... that could be the problem.
|
|
#3
|
|||||
|
|||||
|
RE: checkbox and file values in forms
thanks
I guess I wasn't clear. I have no problem uploading and moving the file. The problem is that when I do, the value of the checkboxes is lost. This what I'm doing: php Code:
That all works fine. What I want to do is put the mysql_query inside an if a statement like so what happens is that the post variable from the checkbox is never set. I am wondering if that problem is in some way related to the fact that I'm sending a file rather than the value of a text area, because I follow a method I use with a text area successfully. |
|
#4
|
|||
|
|||
|
RE: checkbox and file values in forms
a closing curly brace inside a comment was the problem all along. the form stuff works fine
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > checkbox and file values in forms |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|