ShoeLace1291 Posted May 22, 2007 Share Posted May 22, 2007 How would I display a text input if a user checks a certain checkbox? This is my code: echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'DTD/xhtml1-transitional.dtd'> <html> <body> <table align='center' width='50%' cellspacing='1' cellpadding='1' border='0'> <tr> <td> <FIELDSET width='50%'> <LEGEND>Upload a File</LEGEND> <form action='upload.php' method='post' name='fileForm' enctype='multipart/form-data'> <div align='center'>Choose a File:</div> <table align='center' cellspacing='1' cellpadding='1' border='0'> <tr> <td><input name='upfile' type='file'></td> </tr><tr> <td><input type='checkbox' name='private' value='1'>Only allow me to see this image</td> </tr><tr> <td><input type='checkbox' name='portfolio' value='1'>Insert this image into my porftolio</td>"; </tr><tr> if($_POST['portfolio']){ echo "<td>Image Title</td> </tr><tr> <td><input type='text' name='title' size='30' value='My Image'></td> </tr><tr> <td>Description</td> </tr><tr> <td><input type='text' name='description' size='30' value='I hope you like my image!'></td> </tr><tr>"; } <td><input type='submit' name='submitBtn' value='Upload'></td></form> </tr> </table> </form></FIELDSET></td></tr></table> </body>"; } Link to comment https://forums.phpfreaks.com/topic/52582-display-a-text-input-if-a-checkbox-is-checked/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.