Hi Colin,

Am not really bent of having the form process on GET. My forms use the POST
method and i am changing it to GET. I simply used the URL path i posted
earlier as a way of idenitfying which of the pics need to be deleted as a
parameter.





Colin Guthrie-6 wrote:
> 
> dele454 wrote:
>> I see exactly what you have been saying - again my mind was too saturated
>> to
>> see clearly! :(
>> 
>> Anyway, just to reply one some of the questions you asked.
>> 
>> The intention is that the user can either delete the picture indivually
>> using the delete button next to each picture or select all and delete
>> all. -
>> but at the same time the user could deselect some pics - the intention is
>> such that the user can delete a lot of pics at once.
>> 
>> The reason my URL looks like am using a GET method is because the delete
>> button is not a button but a link. the full view of my design is this
>> just
>> to explain a bit more:
>> 
>> http://www.nabble.com/file/p19520252/untitled-2.gif 
>> 
>> I see what am doing wrong now - just to butress on your suggestions, i
>> need
>> to make that 'delete' button an actual button not a link - so the form
>> can
>> actually get submitted naturally via the POST method. From my controller
>> retrieve the delete[] and iterate for deletion.
>> 
>> I see clearly now. I think i got confused along the line while coding. 
> 
> 
> That's OK, and don't worry about the initial reply, it happens to us all 
> from time to time.
> 
> You could still keep you delete button as a link if you like.
> 
> If you have the form, you can just do something like....
> 
> <form id="myform" method="get" action="/my/url/handler">
>   <input type="checkbox" name="delete[]" value="123" />
>   <input type="checkbox" name="delete[]" value="456" />
>   <input type="checkbox" name="delete[]" value="789" />
>   etc.
> </form>
> 
>  # Delete 
> Selected 
> 
> That should then post your form to the following URL:
> /my/url/handler?delete[]=123&delete[]=456
> 
> (assuming the first two checkboxes are selected and the third is not).
> 
> This value will appear in PHP's $_GET array and in the ZendFrameworks 
> request object as an array containing two numbers, 123 and 456.
> 
> This is pretty much exactly what you want I believe and shouldn't 
> require much in the way of reengineering.
> 
> All that said, it's still a good general rule not to do anything 
> destructive with GET requests and links, the reason being that some 
> browsers could (for example) preload links (it wouldn't happen here as 
> there is javascript involved).
> 
> If, however you use simple GET links to delete the individual images in 
> your gallery, of the form:
> 
>  /my/url/handler?delete[]=123 Delete this image 
> 
> Then it is *very* possible a browser could try and preload that URL when 
> you visit the page (remember that the AVG antivirus tool used to preload 
> all the links on a page!)
> 
> This is why anything destructive should only be done via a POST.
> 
> Hope this helps.
> 
> Col
> 
> 
> -- 
> 
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
> 
> Day Job:
>    Tribalogic Limited [http://www.tribalogic.net/]
> Open Source:
>    Mandriva Linux Contributor [http://www.mandriva.com/]
>    PulseAudio Hacker [http://www.pulseaudio.org/]
>    Trac Hacker [http://trac.edgewall.org/]
> 
> 
> 


-----
dee
-- 
View this message in context: 
http://www.nabble.com/Passing-an-array-from-PHP-to-Javascript-tp19511848p19525409.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to