CGI cannot get the Value after click the button. URGENT!!!

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers CGI cannot get the Value after click the button. URGENT!!!
# 1  
Old 07-23-2009
CGI cannot get the Value after click the button. URGENT!!!

Hi Everyone,

I am facing a problem, regarding cgi cannot receive the value from HTML after click submit. Here is the code

cat <<-__EOF__
Content-type: text/html
<script language="JavaScript">
function trim(str)
str = str.replace( /^\s+/g, "" );// strip leading
return str.replace( /\s+$/g, "" );// strip trailing
<form name=loginForm id=loginForm method=post action="login.cgi">
<td colspan="2" class="LabelStyle1">LOGIN</td>
<td><b>User ID: </b>
<input type=text name=username value="" size="15"/></td>
<td colspan="2" class="blank">&nbsp;</td>
<td colspan="2" class="blank">&nbsp;</td>
<td class="userPass">Password</td>
<td><input id="pwd" class="inputText" type="password" size="15" /></td>
<td colspan="2" class="blank">&nbsp;</td>
<tr><td align=center>
<font color=red size="+6"><b>$ErrorMessage</b></font>
<td><font size=+1><input type=submit
name=btnLogin value="Login"></font>
<td><input type="button"
value="Clear" />
<td colspan="2" class="blank">&nbsp;</td>

echo "username=$username" >> aa.log

if [ "$username" == "123" ]
ErrorMessage="INVALID USER ID"
elif [ "$username" == "333" ]

I just wan to get the USERNAME name after the user key and click the button. But, USERNAME is empty that show in the log, seen like after click it will refresh to clear the USERNAME again. Do you know how to get the value after click the button? So, it can do the checking to display error message in the same page or run to other page. My purpose is just wan to know how to get the value after user key in then enter without clear the USERNAME.

Thank you
# 2  
Old 07-24-2009
Use CODE-tags when posting code, data or logs to enhance readability and to preserve formatting like indention etc., ty.

Also, urgent stuff should be posted here:
Emergency UNIX and Linux Support !! Help Me!! - The UNIX and Linux Forums
# 3  
Old 07-25-2009
CGI form values will not automagically become variables in your receiving shell script. According to CGI specification, you need to parse $QUERY_STRING for GET, or read from standard input for parsing POST data.

Unfortunately, unlike environments such as Perl and PHP, you will need to do all this messy things yourself.

Something like this (untested as I don't use bash for CGI): Bash.CGI
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

CURL Button Click Issue

I am trying to perform a button click via cURL and I am having an issue possibly due to java script on click. The HTML source code is: <input id="ctl00_SPWebPartManager1_g_1bb6dc86_55ab_4ea9_a4db_4747922a8202_ctl00_RequestOption_0" class="radio" type="radio" checked="checked" value="1"... (5 Replies)
Discussion started by: js0505
5 Replies

2. Web Development

Cannot execute sh file using button click in php file in apache

I the problem that i facing is cannot use button click to execute the sh file that store in the same location. the program file is a php file and running in apache2. the code that i run is show below <button onclick="sh()" name="sh">SH</button> <script type='text/javascript'> function sh()... (5 Replies)
Discussion started by: zhengkoon8
5 Replies

3. Shell Programming and Scripting

Create download button using perl CGI

Hi, I want to insert in a page a .html button that - once it is clicked - opens a save file dialog box by using perl CGI . I know that to create a link to do that I've done : print $cgi->p ( { -class => 'linc' },);I want to do something similar for a download button (0 Replies)
Discussion started by: black_fender
0 Replies

4. Shell Programming and Scripting

Validation of Text field while Click on submit button

I am using Perl CGI. I have created some text fields and getting those values. But i want if user leave the text field blank when he click on submit button then instead of run a script it should give a popup. Please any body suggest me something..??? (0 Replies)
Discussion started by: Navrattan Bansa
0 Replies

5. Shell Programming and Scripting

Help to create a Return Button using shell script CGI

Hello Guys, I would like to know how can I create a radio button on that its possible to return to the last page, using a ksh CGI shell script. Can someone help ? Thanks so much !!!:b: I tried this, but it is a javascript code ! <INPUT TYPE="button" VALUE="BACK" ... (2 Replies)
Discussion started by: robdcb
2 Replies

6. Shell Programming and Scripting

Python- Changing background color on Button click

Hi, I am trying to write a python program which changes background color on click of button. However i am stuck up. Instead of changing the color currently it is creating a new frame every time. please look at the code and let me know how to correct it #!/usr/bin/env python from Tkinter... (0 Replies)
Discussion started by: vickylife
0 Replies

7. Solaris

executing cgi programs in solaris(B89) needed urgent help,pls!

Hi all, I am trying to execute cgi scripts on solaris, but everytime i get a internal server error... The syntax of my .cgi script is correct as ive checked.. Steps i followed 1.started apache 2.The UNIX and Linux Forums - Learn UNIX and Linux from Experts (in opera) 3.places my cgi scripts... (7 Replies)
Discussion started by: wrapster
7 Replies

8. Solaris

Comprehensive system documentation by button click

Guys There's a new WebPage where you can generate a comprehensive detailed system documentation by button click. Look at the example at ;) Interested, go to Cheers (0 Replies)
Discussion started by: lebch
0 Replies

9. UNIX for Dummies Questions & Answers

Left click select,right click copy

Hi all, when i ssh into my linux machine, i can do a double left click and then right click to paste it anywhere i need. However, on the actual machine, in the terminal, i cannot do a double left click and right click to paste it. i need to right click and select Copy followed by click click... (1 Reply)
Discussion started by: new2ss
1 Replies

10. Shell Programming and Scripting

Calling CGI Perl in Shell script [urgent]

All I want to call a perl program from my shell script. Please help me. I want to call through URL only. Like "" Please help to write this script. Thanx in advance. Thanking you Regards Deepak Xavier (0 Replies)
Discussion started by: DeepakXavier
0 Replies
Login or Register to Ask a Question