【請教】使用CGI獲得變數名和變數值
我現在要使用CGI獲得從HTML表單傳過來的數據,但是我不知道怎麼解析出變數名和變數值。哪位高手可以幫幫我?
可以使用C語言和Bash寫CGI,謝謝了!
這是示例HTML
<form action="cgi-bin/go.cgi">
<input type=text value="I love you" name="text"><br>
<input type=submit value="SUBMIT" name=su><br>
</form>
我就是需要得到
text = I love you
su = SUBMIT
需要分別得到變數名和變數值。
《解決方案》
試試 eybuild
char * s1 = getParameter("text");
char * s2 = getParameter("su");
http://www.eybuild.com/develop/download.htm
《解決方案》
能用中文告訴我eybuild在linux下的編譯過程嗎?
cc=arm-linux-gcc!
《解決方案》
#!/bin/sh
# let the browser know that this is html code
echo "Content-type: text/html"
echo ""
# our html code
echo "<html>"
echo "<head><title>Hello CGI</title></head>"
echo "<body><pre>"
# print out the environment settings
/usr/bin/env
echo "</pre></body>"
echo "</html>"
《解決方案》
數據如何從/usr/bin/env取出來?
那就是你的shell編程的基本技能了。