Skip to content
Advertisement

CGI web application, struggle with variables

this is my first post here. Been reading stackoverflow for a long time and i want to take a time to appreciate everything you do to help community. Thank you.

A lack of knowledge in scripting area leads me to creating this post. Due to complication of my problem (in my opinion) i wasnt able to google the solution. First of all – i would really appreciate any related material links to be able to leard by myself. If there is any modern solution for what im trying to do – i’d rather switch from bashcgiphp to it since i dont know much.

I have an apache 2.4 and what im doing is trying to create web application. It now has bash syntacsis but i will convert it to CGI later on when figure out how to build working bash script. It does:

JavaScript

So the problem is that i cant figure out how to use a pool of created variables and assign them to another variable, $srv_list. So that when users enter text into a web form, the script reacts only to values from variables. And another problem is to create web form in which for variables $srv1 and $srv2 entered text goes to script and executes it. And the time when people enter text from web-form application, variable will evalute to script and execute it. Im reading this post atm http://www.yolinux.com/TUTORIALS/BashShellCgi.html And trying to create something similar. Thanks in advance.

Advertisement

Answer

Instead of creating each variable once create an array:

JavaScript

And to process this list you can loop over the array with for:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement