Mozilla 도움말 검색

고객 지원 사기를 피하세요. 저희는 여러분께 절대로 전화를 걸거나 문자를 보내거나 개인 정보를 공유하도록 요청하지 않습니다. "악용 사례 신고"옵션을 사용하여 의심스러운 활동을 신고해 주세요.

자세히 살펴보기

Not seeing the display from a python script that is expected. Page source shows the correct data

more options

Running a python script

#!/usr/local/bin/python
print("Content-Type: text/html\n\n")
print("<!DOCTYPE html>")
print("<html>")
print("<body>")
import mysql.connector
mydb=mysql.connector.connect(
  host="localhost",
  user="root",
  password="XXXXXXXX",
  database="budget_2019"
)
cursorObject=mydb.cursor()
query="show tables"
cursorObject.execute(query)
print ("<table  class=box >")
print ("<TR><TH Colspan='1'>Expenses</TH></TR>")
print ("<form action=viewcf.php method=GET>")
print ("<input type=hidden name=mon value=7>")
print ("<input type=hidden name=year value=2023>")
myresult = cursorObject.fetchall()
for x in myresult:
	print("<TR><TD><input type=radio name=dbtable value={}></TD></TR>".format(x))
print("</form>")
print("</table>")
print("</body>")
print("</html>")
mydb.close()

Script runs successfully from the command line, giving this output Content-Type: text/html

<!DOCTYPE html>
<html>
<body>
<table  class=box >
<TR><TH Colspan='1'>Expenses</TH></TR>
<form action=viewcf.php method=GET>
<input type=hidden name=mon value=7>
<input type=hidden name=year value=2023>
<TR><TD><input type=radio name=dbtable value=('Charity',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Clothing',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Food',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Housing',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Insurance',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Medical',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Personal',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Recreation',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Taxes',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Transportation',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Utilities',)></TD></TR>
</form>
</table>
</body>
</html>

When run through Firefox I get the page seen in the attached image

Page Source from Tools->Browser Tools->Page Source looks like this

<!DOCTYPE html>
<html>
<body>
<table  class=box >
<TR><TH Colspan='1'>Expenses</TH></TR>
<form action=viewcf.php method=GET>
<input type=hidden name=mon value=7>
<input type=hidden name=year value=2023>
<TR><TD><input type=radio name=dbtable value=('Charity',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Clothing',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Food',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Housing',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Insurance',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Medical',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Personal',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Recreation',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Taxes',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Transportation',)></TD></TR>
<TR><TD><input type=radio name=dbtable value=('Utilities',)></TD></TR>
</form>
</table>
</body>
</html>

Running a python script <pre><nowiki>#!/usr/local/bin/python print("Content-Type: text/html\n\n") print("<!DOCTYPE html>") print("<html>") print("<body>") import mysql.connector mydb=mysql.connector.connect( host="localhost", user="root", password="XXXXXXXX", database="budget_2019" ) cursorObject=mydb.cursor() query="show tables" cursorObject.execute(query) print ("<table class=box >") print ("<TR><TH Colspan='1'>Expenses</TH></TR>") print ("<form action=viewcf.php method=GET>") print ("<input type=hidden name=mon value=7>") print ("<input type=hidden name=year value=2023>") myresult = cursorObject.fetchall() for x in myresult: print("<TR><TD><input type=radio name=dbtable value={}></TD></TR>".format(x)) print("</form>") print("</table>") print("</body>") print("</html>") mydb.close() </nowiki></pre><br> Script runs successfully from the command line, giving this output Content-Type: text/html <pre><nowiki><!DOCTYPE html> <html> <body> <table class=box > <TR><TH Colspan='1'>Expenses</TH></TR> <form action=viewcf.php method=GET> <input type=hidden name=mon value=7> <input type=hidden name=year value=2023> <TR><TD><input type=radio name=dbtable value=('Charity',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Clothing',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Food',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Housing',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Insurance',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Medical',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Personal',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Recreation',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Taxes',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Transportation',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Utilities',)></TD></TR> </form> </table> </body> </html> </nowiki></pre><br> When run through Firefox I get the page seen in the attached image Page Source from Tools->Browser Tools->Page Source looks like this <pre><nowiki><!DOCTYPE html> <html> <body> <table class=box > <TR><TH Colspan='1'>Expenses</TH></TR> <form action=viewcf.php method=GET> <input type=hidden name=mon value=7> <input type=hidden name=year value=2023> <TR><TD><input type=radio name=dbtable value=('Charity',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Clothing',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Food',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Housing',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Insurance',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Medical',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Personal',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Recreation',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Taxes',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Transportation',)></TD></TR> <TR><TD><input type=radio name=dbtable value=('Utilities',)></TD></TR> </form> </table> </body> </html></nowiki></pre><br>
첨부된 스크린샷

글쓴이 cor-el 수정일시

모든 댓글 (1)

more options

Firefox doesn't automatically display the value of a radio button next to the control. You can add that to your script.

https://developer.mozilla.org/docs/Web/HTML/Element/input/radio