It is currently Thu Mar 28, 2024 8:35 am


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: CGI Perl - changing action and mode variables
PostPosted: Wed Oct 12, 2022 11:44 am 
Newbie
Newbie

Joined: Fri Jul 15, 2022 1:13 pm
Posts: 2
I am somewhat of a novice with CGI Perl and am working on a web app that uses 'mode' and 'action' variables to determine which pages load.

$mode = param('mode');
$action = param('action');

if ($mode eq 'page1') {

if ($action 'eq') {

&performAction;
}
displayPage1;
}
elsif ($mode eq 'page2') {

&displayPage2
}
During development I have been having trouble figuring out the best way to set these variables when trying to navigate to different modes/actions after a form submit.

In some cases, putting a hidden value in the form will work

hidden(-name=>'action',-value=>'save')
but sometimes it will not. In case of the latter, putting param('action',"save") before the form will make the action change when the form is submitted. I am unable to figure out why this happens though, are there factors that affect these two variables that I am unaware of?

What I now need to do is have two buttons on the same form, one which will just set the action to save the form data, and another which will save the form data but navigate to another mode/page with that form data.

If anyone could at least point me in the right direction for what I should be researching I would be greatly appreciative.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ]  Moderators: Moderators, Support Team

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Hosting | Domains | Servers | Extras | Order | Support | Contacts | FreeHostia © 2011