Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Closed Thread
Can I put multiple buttons in a form that change the postback url?
Old 12-16-2005, 11:37 AM Can I put multiple buttons in a form that change the postback url?
Junior Talker

Posts: 4
Trades: 0
I am writing a php script that lets a user choose image files on their hard drive for later upload.

When they select a file I post back to the same page and add the file path and name string to a session array.

Every time they choose a file and the php posts back to the same page, I loop through the array and draw a table that shows the images that have been picked.

Here is where I am confused:

I want a "remove" button next to each image in the table. That button would once again post back to the same page sending a variable in the query string representing the array index of that image. It would remove that index from the array and redraw the table.

I have created a working example but to do that I had to put each "remove" button in it's own form.

******************
I would MUCH rather draw the whole table in the same form. Can I make a form post back to different url depending on which button was clicked?
******************

Thanks for your time,
Stan
Stanly22 is offline
View Public Profile
 
 
Register now for full access!
Old 12-16-2005, 12:05 PM
akratellio's Avatar
Experienced Talker

Posts: 30
Location: Berlin Germany Europe World
Trades: 0
hi Stanly22,

you can create a link where you add the url of the picture.
like this:
<a href="<?php print $PHP_SELF.'?picurl=url_of_the_picture';?>">delete</a>

now you can take $_GET['picurl'] and search the session array.
like this:
Code:
<?php

foreach($_SESSION as $k => $v){
   
   if($v == $_GET['picurl']){

       unset $_SESSION[$k];

       }

}

?>
after that you can call up the session array and it will show all
pictures without the one you have deleted.

mfg

akratellio
__________________
I'm always lying...
Ich lüge immer...

Please login or register to view this content. Registration is FREE
akratellio is offline
View Public Profile Visit akratellio's homepage!
 
Old 12-16-2005, 12:48 PM U R Awsome!
Junior Talker

Posts: 4
Trades: 0
That makes so much sense! Why didn't I think about that? I will try it now. Thanks.
Stanly22 is offline
View Public Profile
 
Old 12-16-2005, 02:04 PM Carrying over text box values-
Junior Talker

Posts: 4
Trades: 0

Now, in each row of the table there is an image and the "remove" link that you helped me create. (which works great I might add)

But there is also a text box in each row. The user types something about each image in each corresponding text box which I want to add to a parallel array. (so the picture at index 'x' matches the description they typed at index 'x' of the other array)

How can I get those values into $_SESSION variables if they click on the "remove" link. I can't use the $_POST that I have been using when the page reloads.

Thanks
Stanly22 is offline
View Public Profile
 
Closed Thread     « Reply to Can I put multiple buttons in a form that change the postback url?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.19120 seconds with 12 queries