Jump to content
Sign in to follow this  
Guest carlvernon

php error when trying to test site

Recommended Posts

Guest carlvernon

i am trying to write my website so that a user enters details in a html form on one page and posts it to another page which is written in php, when i try to test this i can enter the details but when i click the submit button it asks me to download or open the php file, and it wont open the page to show the forms data from the html page. Is this just because i dont have php installed correctly on my pc or is it likly to be a code error, here is the codehtml form page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Online T-Shirt Design & Payment System</title></head><body><h4>T-Shirt Design Form</h4><p> </p><form action="process.php" method="post">  <p>    <label>T-Shirt Colour    <select name="tshirtcolour">	<option>Red</option>	<option>Green</option>	<option>Blue</option>    </select>    </label>  </p>  <p>    <label>Font    <select name="font">	<option>Ariel</option>	<option>Comic Sans Serif</option>	<option>Times New Roman</option>    </select>    </label>  </p>  <p>    <label>Font Colour    <select name="fontcolour">	<option>Red</option>	<option>Green</option>	<option>Blue</option>    </select>    </label>  </p>  <p> </p>  <h4><label>Please select a T-Shirt style</label></h4></p>     <p><label> Style A</label> <img src="round neck.jpg" alt="style 1" width="105" height="85" /></p>   <p><label> Style B</label> <img src="v neck small.jpg" alt="style 2" width="105" height="73" /></p>    <p><label> Style C</label> <img src="style 3.jpg" alt="style 3" width="105" height="73" /></p>     <p>    <label>Choose 1 of the style as shown above    <select name="shirt style">	<option>Style A</option>	<option>Style B</option>	<option>Style C</option>    </select>    </label>  </p></form><p> </p></body></html>

php page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html  xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Online T-Shirt Design & Payment System</title></head><body><?php$tshirtcolour = $_POST['tshirtcolour'];$font = $_POST['font'];$fontcolour = $_POST['fontcolour'];$shirtstyle = $_POST['shirtstyle'];echo "You ordered ". $tshirtcolour . " " . $font . "  " . $fontcolour . "  " . $shirtstyle . ".<br />";echo "Thank you for ordering";?></body></html>

Share this post


Link to post
Share on other sites
Guest madhuhari
i am trying to write my website so that a user enters details in a html form on one page and posts it to another page which is written in php, when i try to test this i can enter the details but when i click the submit button it asks me to download or open the php file, and it wont open the page to show the forms data from the html page. Is this just because i dont have php installed correctly on my pc or is it likly to be a code error, here is the codehtml form page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Online T-Shirt Design & Payment System</title></head><body><h4>T-Shirt Design Form</h4><p> </p><form action="process.php" method="post">  <p>    <label>T-Shirt Colour    <select name="tshirtcolour">	<option>Red</option>	<option>Green</option>	<option>Blue</option>    </select>    </label>  </p>  <p>    <label>Font    <select name="font">	<option>Ariel</option>	<option>Comic Sans Serif</option>	<option>Times New Roman</option>    </select>    </label>  </p>  <p>    <label>Font Colour    <select name="fontcolour">	<option>Red</option>	<option>Green</option>	<option>Blue</option>    </select>    </label>  </p>  <p> </p>  <h4><label>Please select a T-Shirt style</label></h4></p>     <p><label> Style A</label> <img src="round neck.jpg" alt="style 1" width="105" height="85" /></p>   <p><label> Style B</label> <img src="v neck small.jpg" alt="style 2" width="105" height="73" /></p>    <p><label> Style C</label> <img src="style 3.jpg" alt="style 3" width="105" height="73" /></p>     <p>    <label>Choose 1 of the style as shown above    <select name="shirt style">	<option>Style A</option>	<option>Style B</option>	<option>Style C</option>    </select>    </label>  </p></form><p> </p></body></html>

php page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html  xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Online T-Shirt Design & Payment System</title></head><body><?php$tshirtcolour = $_GET['tshirtcolour'];$font = $_GET['font'];$fontcolour = $_GET['fontcolour'];$shirtstyle = $_GET['shirtstyle'];echo "You ordered ". $tshirtcolour . " " . $font . "  " . $fontcolour . "  " . $shirtstyle . ".<br />";echo "Thank you for ordering";?></body></html>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...