Jump to content

Display a Text Input if a Checkbox is Checked


ShoeLace1291

Recommended Posts

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>";

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.