Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've been slaving over google for what seem like days now and have yet to find a way to pass multiple variables to a cgi script. What I've got set up so far is an html document that has two forms on it. The user enters things into the forms and clicks submit. It then sends these variables to my cgi script. At this point this is what I have.
I think this would work if I could get awk to use & as a seperator, but I've only had success with = for some reason. Right now that code generates " is to dog" if cat and dog are entered into each input box.
OK I thought this would work out great, but now it's driving me insane.
I'm setting up my box so people can give 3 inputs, frequency, duration, and receptions. I'm trying to write a script that will pass that data to the beep program that beeps my motherboard speaker. I had this working fine when it only took one variable. Something here is messed up. When the html frontend calls this page http://z4x.net:81/cgi-bin/private/se...epetitions=334 I get this for an output "2500 500 334 2500 500 334 2500 500 334". Now, why in the world is it repeating 3 times?
This is my adaptation of your example script.
Code:
#!/bin/bash
echo -e "Content-type: text/html\n\n<html><body>"
IFS="&"
for pair in $QUERY_STRING;do
hz=`echo $pair | awk -F= '{print $2}'`
echo "$hz"
done
for pair in $QUERY_STRING;do
ms=`echo $pair | awk -F= '{print $2}'`
echo "$ms"
done
for pair in $QUERY_STRING;do
reps=`echo $pair | awk -F= '{print $2}'`
echo "$reps"
done
echo "</body></html>"
exit 0
OK this is pissing me off, can we say that here? I can get it to spit out all the names, or all the values, but no matter what I try, I can't get it to just give me one value. Even awking $value for $1 is all messed up. I need it to assign each individual value as a variable, not all 3 as one. It seems what you gave me would work if there was only one pair of values in the query string, but I need to use more than that.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.