简体   繁体   中英

HTML5 form with cgi app

I am doing a html5 form, it asks for build a form with teacher's cgi. I am confuse how to submit form information to his cgi. It return an error values.

It should return a list of track title, if we submit it right. Here is part of my code.

<FORM ACTION="xx.cgi">
<INPUT TYPE="TEXT" NAME="Field" SIZE="25"><BR>
<INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Submit">

Not sure where you get all the values, but this should get you pointed in the right direction.

Your form must have:

enctype="application/x-www-form-urlencoded"

To be compatible with your cgi script.

$time = date("Y-m-d H:i:s");    
$ip = $_SERVER['REMOTE_ADDR'];
$page = parse_url($_ENV["SCRIPT_NAME"],PHP_URL_PATH);
echo <<<EOT
<form action="xx.cgi" method="post" enctype="application/x-www-form-urlencoded"><div>
<input type="text" name="album" size="25"><br/>
Subs: <input type="radio" name="subs" value="1"> Yes
<input type="radio" name="subs" value="2"> No
<br/><input type="submit" name="submit" value="Submit">
<input type="hidden" name="tracktime" value="$time" />
<input type="hidden" name="ip" value="$ip" />
<input type="hidden" name="page" value="$page" />
</div></form>
EOT;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM