Goahead outputs the foreground form content to the background

Source: Internet
Author: User

Note: After completing the goaheaders, output the single content of the front table to the back end. Modify route.txt in the configuration file. Otherwise, an error is reported.

1. First find the goahead. c file under the goahead-4.0.2/src directory

 

Declare a static int test (webs * WP) before its Mian );

 

Add

 

Websdefineaction ("test", test );

 

Defined after the main part

 

Static int test (webs * WP)

 

{

 

Int I = 0;

 

Char * u, * P;

 

U = websgetvar (WP, "username ","");

 

P = websgetvar (WP, "PWD ","");

Printf ("username: % s \ npwd: % s \ n", U, P );

Webswrite (WP, "username: % s \ n", U );

Webswrite (WP, "PWD: % s \ n", P );

 

Webssetstatus (WP, 200 );

 

Webswriteheaders (WP, 0, 0 );

 

Webswriteendheaders (WP );

 

Websdone (WP );

 

Return 0;

 

}

 

Save and re-compile goahead

./Congfigure make sudo make install

 

2. Compile the front-end file. The file name here is formtest. asp.

 

Create a new web directory under goahead-3.6.5/bliud/linux-x86/bin to store it

 

<! Dostype HTML>

 

<HTML>

 

<Head>

 

<Title> formtest </title>

 

<Meta charset = "UTF-8">

 

</Head>

 

<Body>

 

<Form action =/goform/test method = "Post">

 

<Table> <tr> <TD> account: </TD> <input type = "text" name = "username"> </TD> </tr>

 

<Tr> <TD> password: </TD> <input type = "password" name = "PWD"> </TD> </tr>

 

<Tr> <TD> <input type = "Submit" value = "Submit"> </TD>

 

<TD> <input type = "reset" value = "reset"> </TD> </tr> </table>

 

</Form>

 

</Body>

 

</Html>

 

Then return to the bin directory and enter sudo goahead-V -- home/etc/goahead/home/tbs/goahead-4.0.2/bliud/linux-x86.../bin/Web 0.0.0.0: 8080

Enter http: // 0.0.0.0: 8080/formtest. asp in the browser

 

 

 

 

Goahead outputs the foreground form content to the background

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.