|
Posted by Robin on 07/07/06 09:23
Robert S wrote:
>>Why are you even passing the filename in a button's name?
>>
>>Why not:
>>
>> <form action=test.php method=post>
>> <div>
>> <input type=hidden name=myfile value="filename.txt">
>> <input type=submit>
>> </div>
>> </form>
>
>
> The page is a fax client that allows large numbers of files to be faxed
> off to multiple recipients. I have a whole lot of buttons and text
> inputs that refer to different files. The receiving page loops through
> $POST and identifies the file that the button refers to. All text
> inputs and checkboxes etc need to be sent to the receiving page, so I
> can't use multiple <form> elements. The example I gave was just an
> illustrative example - its not from my code. As far as I can see this
> seems to be the only way of doing it. The files are .PDF files created
> by cups-pdf - so they are FULL of underscores. If I use an <a href>
> tag, the POST variables don't get sent to the receiving page.
>
> bin2hex looks like the way to go.
>
If you don't mind assuming that javascript is on then:
one of these:
<input type='hidden' name='myfile' value='' />
and many of (assuming form's name is 'myform'):
<input type='submit'
onclick='document.myform.myfile.value="filename.txt"' />
-------------------------------------------------
Alternatively, assuming the buttons have the filename as their text,
just have many:
<input type='submit' name='myfile' value='filename1.txt' />
<input type='submit' name='myfile' value='filename2.txt' />
<input type='submit' name='myfile' value='filename2.txt' />
....
then $_POST['myfile'] should be the value field of the clicked submit
button.
Navigation:
[Reply to this message]
|