Page 1 of 1

why my program doesn't work?

Posted: Wed Aug 13, 2003 8:08 am
by pnxi
I just create a html form, which include a table in the form and a seperate php file, but why the I click the button, the php code doesn't response the html form, I tried tutorial example, it works fine, can anybody help? thanx.
here is html form:

Code: Select all

<html>
     <head>
           <title>Welcome to my site</title>
           <meta http-equiv="Content-Type" content="text-html;charset=iso-8859-1">
     </head>
<body bgcolor="#C0C0C0">
          
     <form action="review.php" method="post">
     <table border="0" width="957" height="438">
     <tr>
        <td width="949" colspan="4" height="28">
           <h2 align="center"><font color="#000080">Welcome to review movies</font></h2>
        </td>
     </tr>
     <tr>
        <td width="299" height="48">
        </td>
        <td width="644" height="48" colspan="3">
        </td>
     </tr>
     <tr>
        <td width="472" colspan="2">
        <b><font color="#000080">
        Please input your name:</font></b>
        <p>
     
           <input type="text" name="uname" size="20">
        
        </p>
        
        </td>
        <td width="471" colspan="2">
        <p align="center"><img border="0" src="4.jpg" width="100" height="123" align="left">
        </td>
     </tr>
     <tr>
        <td width="299">
        <hr>
        </td>
     </tr>
     <tr>
        <td width="937" height="60" colspan="4">
             
        <b><font color="#000080">Gender:</font></b>
        <p>
      
        <b><font color="#000080">
        <input type="radio" name="sex" value="V21">male<input type="radio" name="sex" value="V22">female</font></b></p>
        </td>
     </tr>
     <tr>
        <td width="345" height="59" colspan="3">
        <hr>
        <b><font color="#000080">
        Movie name: Terminator III</font></b>
        </td>
        <td width="604" height="59">
        <img border="0" src="3.jpg" width="102" height="140"> <img border="0" src="2.jpg" width="100" height="140">
        <img border="0" src="1.jpg" width="99" height="138">
        </td>
     </tr>
     <tr>
        <td width="299">
        <hr>
        <b><font color="#000080">You can review the movie as follow options:</font></b>
        </td>
     </tr>
     <tr>
        <td width="949" height="21" colspan="4">
        <b><font color="#000080">Acting:</font></b>
        <b><font color="#000080"><input type="radio" name="group1" value="A1" checked>1
        <input type="radio" name="group1" value="A2">2
        <input type="radio" name="group1" value="A3">3
        <input type="radio" name="group1" value="A4">4
        <input type="radio" name="group1" value="A5">5
        </font></b>
        </td>
     </tr>
     <tr>
        <td width="949" height="21" colspan="4">
        <font color="#000080"><b>Actor:</b></font>
        <b><font color="#000080"><input type="radio" name="group2" value="Actor1" checked>1
        <input type="radio" name="group2" value="Actor2">2
        <input type="radio" name="group2" value="Actor3">3
        <input type="radio" name="group2" value="Actor4">4
        <input type="radio" name="group2" value="Actor5">5
        </font></b>
        </td>
     </tr>
     <tr>
        <td width="949" height="21" colspan="4">
        <font color="#000080"><b>Plot:</b></font>
        <b><font color="#000080"><input type="radio" name="group3" value="p1" checked>1
        <input type="radio" name="group3" value="p2">2
        <input type="radio" name="group3" value="p3">3
        <input type="radio" name="group3" value="p4">4
        <input type="radio" name="group3" value="p5">5
        </font></b>
        </td>
     </tr>
     <tr>
        <td width="949" height="21" colspan="4">
        <font color="#000080"><b>Music:</b></font>
        <b><font color="#000080"><input type="radio" name="group3" value="m1" checked>1
        <input type="radio" name="group4" value="m2">2
        <input type="radio" name="group4" value="m3">3
        <input type="radio" name="group4" value="m4">4
        <input type="radio" name="group4" value="m5">5
        </font></b>
        </td>
     </tr>
     <tr>
        <td width="949" height="21" colspan="4">
        <input type="button" value="send form" name="submit">
        </td>
     </tr>
     </table>
     <form/>
</body>
</html>
and php file

Code: Select all

<?php
      echo ("Welcome, " . $uname . "!<br>");
      echo("You didn't choose your gender<br>");
      echo ("Your gender is: " . $sex);
      echo ("<br>Your review for the movie: <br>");
      echo ("For acting: " . $group1);
      echo ("<br>For actor: " . $group2);
      echo ("<br>For plot: " . $group3);
      echo ("<br>For music: " . $group4);
      echo ("<br>You opinion for the movie is: " . ($group1 + $group2 + $group3 
      + $group4)/5)
?>
please paste and have a look.

Posted: Wed Aug 13, 2003 8:09 am
by Seth_[php.pl]

still doesn't work

Posted: Wed Aug 13, 2003 10:07 pm
by pnxi
Hi, I tried to change like what jason told me, but seems still doesn't work at all, can you have a look and try to fixed for me, thanks.

Posted: Wed Aug 13, 2003 10:17 pm
by McGruff
Not many people have the time to fix your scripts for you. You're much more likely to get help if you narrow the problem down to a short block of code.

See if you can isolate the problem: a common debugging technique is to echo vars or print_r arrays to check vars which you expect to be declared ARE actually declared, and with the expected values.

To begin with, try:

Code: Select all

<?php
echo '<pre>';
print_r($_POST);
echo '</pre>';
?>
.. at the start of your form processor to check that form field values are being posted to your script.

Posted: Thu Aug 14, 2003 5:19 am
by iamwho
<input type="button" value="send form" name="submit"> ==> should be
<input type="submit" value="send form" name="submit">