html/bash button


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting html/bash button
# 1  
Old 06-11-2011
html/bash button

Hello everyone I am writing a cgi script in bash/html. I am trying something new with this one I have seperated the html code from the scripting. The html code is found in text files on the drive and the scripting is only one script in the cgi bin and i am using
"<select multiple name="state" size="4">
<option value="california" selected>" to change the page accounting to the state the user chooses. I do this using if statements/blocks and after they submit their choice it echos a text file and changes the page . I would like to do this with buttons as well but can't figure out how to make a button change the value of a variable. Anyone have any ideas?
Note: I am writing my sites in bash and html on a opensuse server
Thank you to anyone who response.
# 2  
Old 06-11-2011
Check the value of the button in the POST or GET values and change what you want accordingly when the next webpage retrieval happens.
# 3  
Old 06-12-2011
This is my start but I'm still a little confused this is what i hgave so far.
Code:
contact=`echo "$QUERY_STRING" | sed -n 's/^.*cm=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
echo "<FORM><INPUT TYPE="submit" VALUE="Back" onClick="$contact=1"></FORM>"

how would set cintact to 1 or 0?

---------- Post updated at 10:35 PM ---------- Previous update was at 04:40 PM ----------

For anyone with the same problem I had who may be new to cgi scripts and like bash/html here is my solution I could not find much took me a while just playing with random code.
Code:
Line 1.
contact=`echo "$QUERY_STRING" | sed -n 's/^.*contact=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
Line 2.
echo "<form method="get">"
Line 3.
echo "<INPUT TYPE="submit" NAME="contact" VALUE="1">" 
Line 4
echo "</form>"
use with if block/statement
if [ "$contact" = "1" ]; then
echo "<h1>YEA!</h1>
fi

I could not find anything straight forward and simple like that hopefully me posting it will help someone else.

Last edited by radoulov; 06-12-2011 at 06:15 AM.. Reason: Code tags.
# 4  
Old 06-12-2011
Worth to mention this guide

Create a GCI using bash scripting

I`ve found it very useful for beginners.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to use HTML in UNIX Bash Scripting?

I am planning to run an automation , Could anyone try to help me to how to write an html in unix scripting so when I try to send email it should work especially with Bold and colors (6 Replies)
Discussion started by: cassia
6 Replies

2. Shell Programming and Scripting

BASH parsing for html tags

Hello can anyone help me parse this line. <tr><td>United States of America</td><td>Dollar</td><td>43.309</td></tr><tr><td>Japan</td><td>Yen</td><td>0.5579</td></tr> the line above did not break. so i would like to have a result like this United States of America Dollar 43.309 Japan... (3 Replies)
Discussion started by: doomsayer16
3 Replies

3. Shell Programming and Scripting

help with a bash script to create a html table

Hi guys as the title says i need a little help i have partisally written a bash script to create a table in html so if i use ./test 3,3 i get the following output for the third arguement in the script i wish to include content that will be replace the A characters in the... (2 Replies)
Discussion started by: dunryc
2 Replies

4. UNIX for Advanced & Expert Users

shellinabox/html help to insert a keypress with an html button

I am trying to use shellinabox as a terminal emulator. Everything is working except there seems to be no way to simulate an F14 button press in shellinabox. I am already embedding shellinabox in an html page so Im am wondering if there is a way to make an html/js button that will pass F14 to the... (0 Replies)
Discussion started by: syadnom
0 Replies

5. Shell Programming and Scripting

Run shell commands via HTML webpage/button?

Hey guys, I got a issue here... we have a development box and a UAT box that our webmasters use, they do the webpage development on the development box and and save changed files to a particular directory on the dev machine. At a certain time of the day a cronjob kicks off and the... (3 Replies)
Discussion started by: zeekblack
3 Replies

6. Shell Programming and Scripting

Remove html tags with bash

Hello, is there a way to go through a file and remove certain html tags with bash? If it needs sed or awk, that'll do too. The reason why I want this is, because I have a monitor script which generates a logfile in HTML and every time it generates a logfile, the tags are reproduced. The tags... (4 Replies)
Discussion started by: dejavu88
4 Replies

7. Shell Programming and Scripting

calling bash from html

I have a bash script (it downloads images and saves them) that I want to call from a link on a web page. I cant seem to make this work:mad: ? It works fine if I call it from command prompt. Any help much apprieciated.... (1 Reply)
Discussion started by: Leahy
1 Replies

8. UNIX for Dummies Questions & Answers

Changing middle mouse button for pasting to right mouse button in cygwin rxvt

Hi, I'm using rxvt in Cygwin and I'm wondering how to change my mouse bindings from the middle button for pasting to the right button. The main reason why I want to do this is because my laptop doesn't have a middle mouse button. Thanks for any help! (2 Replies)
Discussion started by: sayeo
2 Replies

9. Shell Programming and Scripting

need help with html button

Hello everyone, I am trying to implement an html button that will call a script and pass two arguments "perl script.pl website.com 1" this is for a search results page on a php spider called "sphider". the variable $url? is the url and Than needs to be one of the arguments in calling the script.... (0 Replies)
Discussion started by: mike171562
0 Replies

10. UNIX for Dummies Questions & Answers

Script for using the Back button and the Close button

Here's a question I have for anyone that might be able to help me: I can write a html script that will allow the user to return to the previous page using the back button, and I can write a script that will allow the user to return to the previous page using the close button, but...is there a... (1 Reply)
Discussion started by: mdgibson
1 Replies
Login or Register to Ask a Question