Page 1 of 1

Changing html page to php ??????

Posted: Sat Feb 02, 2008 8:13 pm
by ashebrian
alright, i'm new to php. I have a html page already designed after i click on the link in the page http://www.skinlogiconline.com/ealu/vou ... seAmt.html BUT i want to post the info from the vouchersChooseAmt.html page to another page in the form of php to make it look exactly like the html file below:

<!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="Page-Enter" content="revealTrans(Duration=4.0,Transition=3)" />
<title>&Eacute;al&uacute; Medi Spa Therapy</title>
<meta http-equiv="Page-Exit" content="revealTrans(Duration=4.0,Transition=3)" />
<meta name="description" content="&Eacute;al&uacute; Medi Spa Therapy" />
<meta name="keywords" content="&Eacute;al&uacute; Medi Spa Therapy" />
<link href="ealumedispa.css" rel="stylesheet" type="text/css" />
<script src="scripts/imagerotator.js" type="text/javascript"></script>
<script src= "scripts/copyingscript.js" type="text/javascript"></script>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
</head>
<body>

<!-- Start of Outer table -->
<table class="table1">
<tr>
<td class="td1">
<!-- Banner Div -->
<div class="wrapper">
<div class="header"><br /><br />
<div class="headershops">
<table class="headerphone">
<tr style="width:100%">
<td style="text-align:center">Newbridge</td>
<td style="text-align:center">Naas</td>
<td style="text-align:center">Portlaoise</td>
<td style="text-align:center">Maynooth</td>
</tr>
<tr style="width:100%">
<td style="text-align:center">(045)899800</td>
<td style="text-align:center">(045)438566</td>
<td style="text-align:center">(057)8678848</td>
<td style="text-align:center">(01)5054622</td>
</tr>
</table>
</div>
<table class="maintable">
<tr>
<td class="td2">
<a href="booking.html" class="header-links">Spa Bookings</a>
<span class="header-links">&nbsp;&nbsp;l&nbsp;&nbsp;</span>
<a href="products.html" class="header-links">Spa Products</a>
<span class="header-links">&nbsp;&nbsp;l&nbsp;&nbsp;</span>
<a href="recruitment.html" class="header-links">Recruitment</a>
<span class="header-links">&nbsp;&nbsp;l&nbsp;&nbsp;</span>
<a href="sitemap.html" class="header-links">Site Map</a>
<span class="header-links">&nbsp;&nbsp;l&nbsp;&nbsp;</span>
<a href="mailto:info@ealuspatherapy.com" class="header-links">Enquires</a>
</td>
</tr>
</table>
</div>

<!-- End Banner -->
<!-- Start Content / Nav Table -->
<table class='maintable'>
<tr>
<td class="td3">
<!-- Start Navigation List -->
<div class="navdiv">
<a href="index2.html" class="nav-txt">Home</a><br />
<a href="awards.html" class="nav-txt">Awards</a><br />
<a href="treatments.html" class="nav-txt">Treatments</a><br />
<a href="brochures.html" class="nav-txt">Brochures</a><br />
<a href="voucher.html" class="nav-txt">Vouchers</a><br />
<a href="specials.html" class="nav-txt">Specials</a><br />
<a href="spaPackages.html" class="nav-txt">Spa Packages</a><br />
<a href="products.html" class="nav-txt">Products</a><br />
<a href="recruitment.html" class="nav-txt">Recruitment</a><br />
<a href="booking.html" class="nav-txt">Bookings</a><br />
<a href="ourLocations.html" class="nav-txt">Our Locations</a><br />
<a href="contactUs.html" class="nav-txt">Contact Us</a>
</div>
<br /><br />
<div class="navdivrebookingshops1">
</div>
</td>
<td class="content">
<!-- Image Sequencer -->
<div class="seqdiv" id="imageContainer">
<img src="images/img-bground.gif" alt="&Eacute;al&uacute; MediSpa Therapy" name="stock4" hspace="0" vspace="0" id="stock4" class="stock4" />
<img src="images/stock3.jpg" alt="&Eacute;al&uacute; MediSpa Therapy" name="stock3" hspace="0" vspace="0" id="stock3" />
<img src="images/stocknaas.jpg" alt="&Eacute;al&uacute; MediSpa Therapy" name="home2" hspace="0" vspace="0" id="stock2" />
<img src="images/stock4.jpg" alt="&Eacute;al&uacute; MediSpa Therapy" name="stock1" hspace="0" vspace="0" id="stock1" />
<div id='blackLayer'>
&nbsp; </div>
</div>
<br />
<script src= "scripts/currentDate.js" type="text/javascript"></script><br />
<br />
<span class="header-txt">Voucher Payment:</span><br />
<br />

<p>At &Eacute;al&uacute; Medi Spa Therapy we understand how busy your life can be, so we offer you the choice and convenience to book with us online. Simply choose the time and date that suits you best and we shall return your appointment confirmation via <b>email</b> or <b>telephone</b>.</p><br />

<p><b>Cancellation Policy:</b></p>

<p>As a common courtesy please provide us with 24 hours notice for cancellations or reschedules. If less than 3 hours notice is given you may be asked to pay for a cancellation fee of up to 50% of your booking.</p><br />

<p><img src="images/list-dot.gif" alt="" /> <i>Please note that bookings must be at least <b>1 day</b> in advance.</i></p>
<p><img src="images/list-dot.gif" alt="" /> <i>and <b>ALL</b> treatments may not be done in the same salon.</i></p><br />

<span class="header-txt">Online Booking:</span><br /><br />

<p><img src="images/list-dot.gif" alt="" /> Please fill in the the correct information.</p>
<p><img src="images/list-dot.gif" alt="" /> Required fields are marked with <b style="color:#FF0000">*</b></p><br />
<br />
Amount: <?php echo $_POST["price"]; ?><br />
How Many? <?php echo $_POST["quantity"]; ?><br />
Voucher Delivery: <?php echo $_POST["deliverymethod"]; ?><br />

<form action="scripts/bookingHairRemovalMail.php" method="post" enctype="multipart/form-data" onSubmit="return check(frmRequest)" name="frmRequest" id="frmRequest">

<table width="100%">
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td style="font-weight:bold"><p>Title</p></td>
<td>
<select name="title">
<option value="Choose Title">Choose Title </option>
<option value="Mr">Mr</option>
<option value="Miss">Miss</option>
<option value="Mrs">Mrs</option>
<option value="Ms">Ms</option>
<option value="Dr">Dr</option>
<option value="Prof">Prof</option>
</select><b style="color:#FF0000">*</b>
</td>
</tr>
<tr>
<td style="font-weight:bold"><p>First Name</p></td>
<td>
<input type="text" name="name" size="20" /><b style="color:#FF0000">*</b>
</td>
</tr>
<tr>
<td style="font-weight:bold"><p>Surname</p></td>
<td>
<input type="text" name="surname" size="20" /><b style="color:#FF0000">*</b>
</td>
</tr>
<tr>
<td style="font-weight:bold"><p>Phone Number</p></td>
<td>
<input type="text" name="phone" size="15" /><b style="color:#FF0000">*</b>
</td>
</tr>
<tr>
<td style="font-weight:bold"><p>Mobile Number</p></td>
<td>
<input type="text" name="mobile" size="15" />
</td>
</tr>
<tr>
<td style="font-weight:bold"><p>Email</p></td>
<td>
<input type="text" name="email" size="20" /><b style="color:#FF0000">*</b>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="font-weight:bold"><p>Preferred Therapist/Stylist</p></td>
<td>
<input type="text" name="therapiststylist" size="20" />
</td>
</tr>
<tr>
<td class="formtd" style="font-weight:bold"><p>Preferred Date</p></td>
<td>
<select name="day">
<option value="Choose Day">Choose Day &nbsp;&nbsp;</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select><b style="color:#FF0000">*</b>
<select name="month">
<option value="Choose Month">Choose Month</option>
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select><b style="color:#FF0000">*</b> </td>
</tr>
<tr>
<td class="formtd" style="font-weight:bold"><p>Preferred Time</p></td>
<td>
<select name="time">
<option value="Choose Time">Choose Time &nbsp;&nbsp;</option>
<option value="1">9:00 am</option>
<option value="2">9:30 am</option>
<option value="3">10:00 am</option>
<option value="4">10:30 am</option>
<option value="5">11:00 am</option>
<option value="6">11:30 am</option>
<option value="7">12:00 pm</option>
<option value="8">12:30 pm</option>
<option value="9">13:00 pm</option>
<option value="10">13:30 pm</option>
<option value="11">14:00 pm</option>
<option value="12">14:30 pm</option>
<option value="13">15:00 pm</option>
<option value="14">15:30 pm</option>
<option value="15">16:00 pm</option>
<option value="16">16:30 pm</option>
<option value="17">17:00 pm</option>
<option value="18">17:30 pm</option>
<option value="19">18:00 pm</option>
<option value="20">18:30 pm</option>
<option value="21">19:00 pm</option>
</select><b style="color:#FF0000">*</b>
</td>
</tr>
<tr>
<td class="formtd" style="font-weight:bold"><p>Preferred Treatment</p></td>
<td><select name="treatment">
<option value="Choose Treatment">Choose Treatment&nbsp;&nbsp;</option>
<option value="1">I.P.L Hair Removal </option>
</select><b style="color:#FF0000">*</b></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="font-weight:bold"><b>Comments</b></td>
<td><textarea rows="8" cols="40" name="comments"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="font-weight:bold"><p>Terms and Conditions:</p></td>
<td>
<input type="checkbox" name="termsandconditions" value="yes" /> I accept <a href="#">Terms & Conditions</a> <b style="color:#FF0000">*</b></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" name="Submit" value="Submit Form" />
<input name="reset" type="reset" value="Clear Form" />
</td>
</tr>
</table>
</form>
<p>&nbsp;</p>
<table width="100%">
<tr>
<td align="center">
<a href="javascript:javascript:history.go(-1)" title="Back to Previous Page" class="backbutton"></a>
</td>
</tr>
</table>

<br /><br />

</td>
</tr>
</table>
<!-- Footer Div -->
<div class="push">
</div>

<div class="footer">
<div class='maindiv'>
<a href="privacyPolicy.html" class="footer-links">Privacy Policy</a>
<span class="footer-links">&nbsp;&nbsp;|&nbsp;&nbsp;</span>
<a href="copyright.html" class="footer-links">Copyright</a>
<span class="footer-links">
<span class="footer-links">&nbsp;&nbsp;|&nbsp;&nbsp;</span>
</span><a href="termsofService.html" class="footer-links">Terms of Service</a>
<span class="footer-links">
<span class="footer-links">&nbsp;&nbsp;|&nbsp;&nbsp;</span>
</span><a href="feedback.html" class="footer-links">Feedback</a>
<p class="style2"> footer info</p>
</div>
</div>
<!-- End of Outer Table -->
</div>
<!-- Wrapper Div -->
</td>
</tr>
</table>
</body>
</html>

as you can see i've added <?php echo $_POST[""]; ?> above the form but doesn't seem to work even when i save the file as html or php.

Please help as i would like a quick fix for this solution. tried searching the web but the info is telling me to do the whole page again.

Re: Changing html page to php ??????

Posted: Sat Feb 02, 2008 8:38 pm
by califdon
Your syntax appears correct. The web server on your site must be configured to preprocess PHP and the standard way to configure them is to recognize a file extension of .php. So the first place to start is to check your web server configuration, unless you know that it already preprocesses other PHP scripts. I assume that the name of the file that you showed us is "voucherLoaded.php", which is what your html file is calling for.

If you have occasion to post code in this forum in the future, please use the Code tags to make it easier for us to read. Thank you.

Re: Changing html page to php ??????

Posted: Sun Feb 03, 2008 5:23 pm
by ashebrian
Thanks a million for the quick reply. At the moment i'm only testing this online. I had a feeling that maybe the hosting web server does not allow php scripts. I already got in touch with them.......and am waiting for their reply.

I have 2 other question.

Firstly, As of what i used to post the php into an ALREADY made html file and saved it as .php.
Will the file have to be saved as .php and not .html. Even if i changed the file to voucherLoaded.html? I believe it will have to stay as .php for the post to work ..... i just want to make sure.

Secondly, I have a products page draft already made in .php files and tested offline which works fine but with a totally different design. Is it possible to cut and paste small php codes into a few html files (i will save them as .php) and keep the original design which was made in css.

That means with the following codes in each page:

Code: Select all

<!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="Page-Enter" content="revealTrans(Duration=4.0,Transition=3)" />
<title>&Eacute;al&uacute; Medi Spa Therapy</title>
<meta http-equiv="Page-Exit" content="revealTrans(Duration=4.0,Transition=3)" />
<meta name="description" content="&Eacute;al&uacute; Medi Spa Therapy" />
<meta name="keywords" content="&Eacute;al&uacute; Medi Spa Therapy" />
<link href="ealumedispa.css" rel="stylesheet" type="text/css" />
<script src="scripts/imagerotator.js" type="text/javascript"></script>
<script src= "scripts/copyingscript.js" type="text/javascript"></script>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
</head>
<body>
</body>
</html>
 
It will be a great help if someone could tell me.

Re: Changing html page to php ??????

Posted: Sun Feb 03, 2008 7:31 pm
by califdon
What file extension you must save it as depends, as I said, on how the web server is configured. Probably 95% of web servers are configured to recognize .php, but just so you know, it is possible to configure them to recognize any other extension. If your web server is Apache, chances are that it is configured for .php, but in case it is a Microsoft IIS web server, it may not be. The sysadmin would have to install PHP extensions for IIS. Likewise, IIS normally supports .asp, whereas Apache normally supports PHP and would have to have Microsoft .asp extensions installed. So it all depends on the web server.

On your other question, yes, you can mix PHP and HTML together, and usually this is exactly what is done. You need to be aware of two things:
1. You have to use the correct file extension on the file (.php in most cases); and
2. All the PHP syntax must be enclosed within <?php and ?> tags.

The PHP will be executed exactly where it is in the file, so you can write HTML that is conditionally placed in the resulting script, depending on the PHP. For example, here are two equivalent ways of writing the same script, to display either "Hello World" or "Goodbye World", depending on whether the $_POST variable has a value of 1 or 0:

Code: Select all

<HTML>
<BODY>
<?php
if ($_POST['data']==1) {
    echo "Hello World";
} else {
   echo "Goodbye World";
}
?>
</BODY>
</HTML>

Code: Select all

<HTML>
<BODY>
<?php
if ($_POST['data']==1) {
?>
Hello World
<?php
} else {
?>
Goodbye World
<?php
}
?>
</BODY>
</HTML>
Which approach you use should depend on how much HTML is to be output. For long stretches of HTML, there's not much point in using a long string of echo commands.

It helps to keep in mind what is actually happening: the web server is requested to deliver a file that has an extension that it recognizes requires pre-processing. It then parses that file, starting at the top, and whenever it finds a <?php tag, it interprets PHP commands until it finds a ?> tag. Everything outside of the tags is just HTML and it is sent without processing.