Foros del Web » Creando para Internet » Diseño web »

python, CGI y las paginas web!!

Estas en el tema de python, CGI y las paginas web!! en el foro de Diseño web en Foros del Web. Para procesar la info. de un form html en un script python, el servidor tiene que tener habilitado el interprete para python verdad???? Y si ...
  #1 (permalink)  
Antiguo 30/07/2008, 07:50
(Desactivado)
 
Fecha de Ingreso: julio-2008
Mensajes: 14
Antigüedad: 15 años, 9 meses
Puntos: 0
python, CGI y las paginas web!!

Para procesar la info. de un form html en un script python, el servidor tiene que tener habilitado el interprete para python verdad???? Y si esta habilitado, el script podria ser algo asi???

Cita:
<?python

#!/usr/bin/python2.5
#
######### don't change the following three lines: ###########
import cgi
print "Content-Type: text/html\n"
form = cgi.FieldStorage()

## add a form.getvalue for each of the names in your form: ##
drink = form.getvalue("drink")

########## start of HTML code ###########
print """
<html>
<head> <title>What would you like to drink</title> </head>
<body>
<h4>Your drink: </h4><p>
"""
############ end of HTML code #############

if drink == "tea":
print "You requested tea"
elif drink == "coffee":
print "You requested coffee"
elif drink == "hot chocolate":
print "You requested hot chocolate"
else:
print "You need to select a drink!"


########### start of HTML code ###########
print """
<p>Thank you for your visit. Please come again. <p>
</body></html>
"""
############# end of HTML code ##############

?>
GRACIAS!!!
  #2 (permalink)  
Antiguo 30/07/2008, 08:10
Avatar de Mikmoro
Colaborador
 
Fecha de Ingreso: octubre-2006
Ubicación: K-pax
Mensajes: 7.228
Antigüedad: 17 años, 6 meses
Puntos: 280
Respuesta: python, CGI y las paginas web!!

Hace poco crearon un subforo específico para python.

http://www.forosdelweb.com/f130/

Seguramente te atenderán mejor allá.
__________________
Visita mi nueva web idplus.org
  #3 (permalink)  
Antiguo 30/07/2008, 08:25
(Desactivado)
 
Fecha de Ingreso: julio-2008
Mensajes: 14
Antigüedad: 15 años, 9 meses
Puntos: 0
Respuesta: python, CGI y las paginas web!!

ok! gracias
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:22.