This is POST form:
<form method ="post" action="New.cgi">
<table>
<tr><td>Select: </td><td><select><option value = "<?php echo substr($_SERVER['REQUEST_URI'], -2)?>">ID</option></select></td></tr><br>
<tr><td>Allow: </td><td><input type ="text" name="Authorize" autofocus required="required"/></td></tr><br>
<br>
</table>
<input type="submit" name = "submitname" value="Add" />
</form>
PHP is used to obtain the last two characters of the URI - in this case, it is "tr".
This is New.cgi using Python:
formData = cgi.FieldStorage()
ID = formData.getvalue('ID')
InputAuthorize = formData.getvalue('Authorize')
print(ID)
print(InputAuthorize)
Whichever value is inputted for 'Authorize' is printed correctly. However, for 'ID', the output is none. So, obviously, I've made a mistake with my POST form code but I am unsure of what it could be. Any help is greatly appreciated!
Aucun commentaire:
Enregistrer un commentaire