...

View Full Version : Trying to grab a GET



graham23s
08-25-2007, 02:18 PM
Hi Guys,

this is a small portion of the code im having trouble with:


</tr>
<tr>
<td align="right" /><b>Upload File</b></td><td align="left"><input type="file" name="file"><form method="get" action="uploadsneeded">
<select name="uploadsneeded">
<option value="2">2</option>
<option value="3">3</option>
</select>
<input type="submit" name="action" value="Go!">
</form>
</td>
</tr>';
?>
<?php
## how many uploads needed ##############################################################
if($_GET['action'] == 'uploadsneeded') {

echo 'uploads code here!';
exit;

}
?>

there is a drop down box which has the value 2 or 3, this dictates how many files the user wants to upload, but im having trouble , after the Go! button is pressed i was trying to get the GET action below to catch the code but its not doing it, can anyone see where i have went wrong?

thanks guys

Graham

Nightfire
08-25-2007, 02:35 PM
<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="file" name="file">
<select name="uploadsneeded">
<option value="2">2</option>
<option value="3">3</option> </select>
<input type="submit" name="submit" value="Go!">
</form>




if(isset($_GET['uploadsneeded'])){
upload code
}

abduraooft
08-25-2007, 02:36 PM
Change if($_GET['action'] == 'uploadsneeded')
to

if($_GET['uploadsneeded']=="2")
{
//
}
elseif($_GET['uploadsneeded']=="3")
{
//
}

The value of the select will be the value of the selected option.

graham23s
08-25-2007, 04:06 PM
thanks a ton guys works great.

Graham



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum