Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

osanseviero Group Title

This is a PHP code to solve syllogisms...any suggestion to make better this code (i know it is in Spanish some parts, sorry)

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. osanseviero Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    <html> <body> <center> <table> Silogismos </table> <form method="post" action="chobbisilogismo.php"> <table border=3 align=center> <tr> <td> <select name="1x"> <option>Todo</option> <option>Algun</option> </select> </td> <td> <input name="1p" type="text" value="Ingresa termino aqui" /> </td> <td> <select name="1y"> <option>es</option> <option>no es</option> </select> </td> <td> <input name="1q" type="text" value="Ingresa termino aqui" /> </td> <tr> <td> <select name="2x"> <option>Todo</option> <option>Algun</option> </select> </td> <td> <input name="2p" type="text" value="Ingresa termino aqui"/> </td> <td> <select name="2y"> <option>es</option> <option>no es</option> </select> </td> <td> <center> <input name="2q" type="text" value="Ingresa termino aqui" /> </td> <tr> <td colspan="4"><center><input type="Submit" value="Resolver Silogismo"></center></td> </tr> </form> <?PHP $X1=$_POST['1x']; $Y1=$_POST['1y']; $P1=$_POST['1p']; $Q1=$_POST['1q']; $X2=$_POST['2x']; $Y2=$_POST['2y']; $P2=$_POST['2p']; $Q2=$_POST['2q']; $F=0; $A=A; $E=E; $I=I; $O=O; $M=0; $N=0; $S=0; if($P1=="Ingresa termino aqui") {$J=0;} else {$J=1;}; if($Q1=="Ingresa termino aqui") {$V=0;} else {$V=1;}; if($Q2=="Ingresa termino aqui") {$T=0;} else {$T=1;}; if($P2=="Ingresa termino aqui") {$B=0;} else {$B=1;}; $K=$J+$V+$T+$B; if($P1==$Q2){$P=$P2;$Q=$Q1;$F=1;} else{ if($Q1==$Q2){$P=$P2;$Q=$P1;$F=2;} else{ if($P1==$P2){$P=$Q2;$Q=$Q1;$F=3;} else{ if($Q1==$P2){$P=$Q2;$Q=$P1;$F=4;} else{ echo " <tr> <td colspan= 4> <center> Corrige tu ortografía en el término medio </center> </td> </tr>"; $S=0;};;};;};}; if($X1=="Todo" && $Y1=="es") {$M=$A;} else{ if($X1=="Todo" && $Y1=="no es") {$M=$E;} else{ if($X1=="Algun" && $Y1=="es") {$M=$I;} else{ if($X1=="Algun" && $Y1=="no es") {$M=$O;} else{echo "Qué pedo?!?!";};};};}; if($X2=="Todo" && $Y2=="es") {$N=$A;} else{ if($X2=="Todo" && $Y2=="no es") {$N=$E;} else{ if($X2=="Algun" && $Y2=="es") {$N=$I;} else{ if($X2=="Algun" && $Y2=="no es") {$N=$O;} else{echo "Qué pedo?!?!";};};};}; if($F==1 && $M=="A" && $N=="A") {$X="Todo"; $Y="es";} else{ if($F==1 && $M=="E" && $N=="A") {$X="Todo"; $Y="no es";} else{ if($F==1 && $M=="A" && $N=="I") {$X="Algun"; $Y="es";} else{ if($F==1 && $M=="E" && $N=="I") {$X="Algun"; $Y="no es";} else{ if($F==2 && $M=="E" && $N=="A") {$X="Todo"; $Y="es";} else{ if($F==2 && $M=="A" && $N=="E") {$X="Todo"; $Y="no es";} else{ if($F==2 && $M=="E" && $N=="I") {$X="Algun"; $Y="no es";} else{ if($F==2 && $M=="A" && $N=="O") {$X="Algun"; $Y="no es";} else{ if($F==3 && $M=="A" && $N=="A") {$X="Algun"; $Y="es";} else{ if($F==3 && $M=="I" && $N=="A") {$X="Algun"; $Y="es";} else{ if($F==3 && $M=="A" && $N=="I") {$X="Algun"; $Y="es";} else{ if($F==3 && $M=="E" && $N=="A") {$X="Algun"; $Y="no es";} else{ if($F==3 && $M=="O" && $N=="A") {$X="Algun"; $Y="no es";} else{ if($F==3 && $M=="E" && $N=="I") {$X="Algun"; $Y="no es";} else{ if($F==4 && $M=="A" && $N=="A") {$X="Algun"; $Y="es";} else{ if($F==4 && $M=="A" && $N=="E") {$X="Todo"; $Y="no es";} else{ if($F==4 && $M=="I" && $N=="A") {$X="Algun"; $Y="es";} else{ if($F==4 && $M=="E" && $N=="A") {$X="Algun"; $Y="no es";} else{ if($F==4 && $M=="E" && $N=="I") {$X="Algun"; $Y="no es";} else{ $S=1;};};};};};;};};};};};};};};};};};};};}; if ($S==0) { echo " <tr> <td><center>"; echo $X1; echo" </center></td> <td><center>"; echo $P1; echo" </center></td> <td><center>"; echo $Y1; echo" </center></td> <td><center>"; echo $Q1; echo" </center></td> </tr> <tr> <td><center>"; echo $X2; echo" </center></td> <td><center>"; echo $P2; echo" </center></td> <td><center>"; echo $Y2; echo" </center></td> <td><center>"; echo $Q2; echo" </center></td> </tr> <tr> <td><center>"; echo $X; echo" </center></td> <td><center>"; echo $P; echo" </center></td> <td><center>"; echo $Y; echo" </center></td> <td><center>"; echo $Q; echo" </center></td> </tr> </table> </center>";} else{ echo " <tr> <td><center>"; echo $X1; echo" </center></td> <td><center>"; echo $P1; echo" </center></td> <td><center>"; echo $Y1; echo" </center></td> <td><center>"; echo $Q1; echo" </center></td> </tr> <tr> <td><center>"; echo $X2; echo" </center></td> <td><center>"; echo $P2; echo" </center></td> <td><center>"; echo $Y2; echo" </center></td> <td><center>"; echo $Q2; echo" </center></td> </tr> <tr> <td colspan=4>"; echo "<center>No se puede concluir nada</center>"; echo" </td> </tr> </table> </center>";}; ?> </body> </html>

    • 2 years ago
  2. Tomas.A Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    use pastebin.com to show your code

    • 2 years ago
  3. agdgdgdgwngo Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    http://ideone.com/jsaB4 I don't know HTML, nor do I know PHP. However, you do have very deeply-nested if-else blocks. Perhaps they are working too hard? Are they trying to do both input validation and logic?

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.