Duplicate Question
The question on this page has been marked as a duplicate question.
Original Question
My first page is <html> <head> <title>Name Game</title> </head> <body> <h1>Name Game</h1> <form action="namegame.py"> <p> Enter...Asked by james
My first page is
<html>
<head>
<title>Name Game</title>
</head>
<body>
<h1>Name Game</h1>
<form action="namegame.py">
<p>
Enter your name: <input type="text" name="name" />
</p>
<p>
<input type="submit" value="Go" />
</p>
</form>
</body>
</html>
My second .py page is
import cgi
form = cgi.FieldStorage()
name = form["name"].value
print """Content-type: text/html
<html>
<head>
<title>Name Game</title>
</head>
<body>
"""
# print HTML body using form data
print "<h1>Name Game</h1>"
print "<dl>"
print "<dt>form["name"].value</dt>"
print "<dd> name </dd>"
print "<dt>Uppercase</dt>"
print "<dd>upper(form["name"].value)</dd>"
print "<dt>No spaces</dt>"
print "<dd></dd>"
print "<dt>No vowels</dt>"
print "<dd></dd>"
print "</dl>"
print "</body></html>"
I want to ask how come form["name"].value is invalid when it is loading the second page?? I just want to show form["name"].value to be the word that the person entered at the first page?? thank you very much
<html>
<head>
<title>Name Game</title>
</head>
<body>
<h1>Name Game</h1>
<form action="namegame.py">
<p>
Enter your name: <input type="text" name="name" />
</p>
<p>
<input type="submit" value="Go" />
</p>
</form>
</body>
</html>
My second .py page is
import cgi
form = cgi.FieldStorage()
name = form["name"].value
print """Content-type: text/html
<html>
<head>
<title>Name Game</title>
</head>
<body>
"""
# print HTML body using form data
print "<h1>Name Game</h1>"
print "<dl>"
print "<dt>form["name"].value</dt>"
print "<dd> name </dd>"
print "<dt>Uppercase</dt>"
print "<dd>upper(form["name"].value)</dd>"
print "<dt>No spaces</dt>"
print "<dd></dd>"
print "<dt>No vowels</dt>"
print "<dd></dd>"
print "</dl>"
print "</body></html>"
I want to ask how come form["name"].value is invalid when it is loading the second page?? I just want to show form["name"].value to be the word that the person entered at the first page?? thank you very much
Answers
There are no human answers yet.
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.