The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> cgi data retrun, cgi
tl234
post May 7 2007, 07:28 PM
Post #1





Group: Members
Posts: 4
Joined: 7-May 07
Member No.: 2,752



I am creating a linux web server, and would like to call some linux command through html.

I am using FORM to create it, below is my code:

-----------------------------------------------------
<html>
<body>

<FIELDSET>
<LEGEND>Command Line Input</LEGEND><P>
<FORM ACTION="/cgi-bin/webserver" METHOD="POST">
<P>Please type your linux command (80 chars max.):<BR>
<INPUT NAME="data" SIZE="60" MAXLENGTH="80"><BR>
<INPUT TYPE=SUBMIT VALUE="Send">
</FORM>
</FIELDSET>

</body>
</html>
-----------------------------------------------------


My webserver is compiled from C code. After I enter the linux command to the command field and then hit Send, it will clear the existing webpage and return the result. How can I modified the html, so that the result return to a table / field in the existing webpage?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post May 7 2007, 08:30 PM
Post #2


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



Please see the FAQ entry Where can I learn about CGI?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
tl234
post May 8 2007, 11:40 AM
Post #3





Group: Members
Posts: 4
Joined: 7-May 07
Member No.: 2,752



How can I do the following in C:

----------------------------------------------------------------
#!/bin/sh
# do processing (or launch it as background job)
echo "HTTP/1.0 204 No Change"
echo

(as non-NPH, you'd simply replace HTTP/1.0 with the Status: CGI header).
----------------------------------------------------------------

How to replace HTTP/1.0 with status : CGI header?


In the beginning of my c file, I do the following and doesn't work:

system("echo HTTP/1.0 204 No Change");
system("echo");
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post May 8 2007, 11:55 AM
Post #4


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



Have you tried
CODE
printf("HTTP/1.0 204 No Change\n\n")
? What kind of programming experience do you have?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
tl234
post May 8 2007, 12:11 PM
Post #5





Group: Members
Posts: 4
Joined: 7-May 07
Member No.: 2,752



Very little in html.

After using printf("HTTP/1.9 204 No Change\n\n"), firefox behaves differently than internet explorer.

Firefox sends data to a new page. However, in internet explorer, it does not send data to new page, but I cannot see the data in the same webpage either. My plan is to display the result to a box in the send page.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post May 8 2007, 04:00 PM
Post #6


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



HTML isn't programming. It's just markup.

You really should learn basic programming in C before you start CGI programming in C. CGI programming adds another layer of complexity that someone who doesn't understand basic programming isn't ready for.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
tl234
post May 9 2007, 10:45 AM
Post #7





Group: Members
Posts: 4
Joined: 7-May 07
Member No.: 2,752



You still not be able to answer my question?

"firefox behaves differently than internet explorer"

"My plan is to display the result to a box in the send page", how can I create it?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post May 9 2007, 12:35 PM
Post #8


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



Can you provide the URL (address) of a document that demonstrates the problem?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th April 2024 - 12:12 PM