|
-
Jan 19th, 2014, 03:03 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] My PHP code is showing up underneath the executed code.
I have spent the last couple of hours developing my code and it seems to be working fine. However i just noticed that the code had started showing up underneath the executed code, i have tried commenting out the lines of code i edited in the last half hour with no fix.
Im using wordpress 3.8 on a localhost.
Code:
<?php
[insert_php]
function IsPostcode($postcode){
$postcode = strtoupper(str_replace(' ','',$postcode));
if(preg_match("/^[A-Z]{1,2}[0-9]{2,3}[A-Z]{2}$/",$postcode) || preg_match("/^[A-Z]{1,2}[0-9]{1}[A-Z]{1}[0-9]{1}[A-Z]{2}$/",$postcode) || preg_match("/^GIR0[A-Z]{2}$/",$postcode))
return true;
else
return false;
}
$ORIGIN = $row[ORIGIN];
//postcode
if (IsPostcode($ORIGIN))
{echo "<tr><td colspan=\"1\" class=\"bold\">Address:</td><td colspan=\"1\"><input type=\"text\" name=\"P_ADDRESS\"></td>";
echo "<td colspan=\"1\" class=\"bold\">Postcode:</td><td colspan=\"1\"><input type=\"hidden\" name=\"P_POSTCODE\" value=\"".$row[ORIGIN]."\"><input type=\"text\" name=\"P_POSTCODE1\" value=\"".$row[ORIGIN]."\" disabled></td></tr>\n";}
//airport
else if (strpos($ORIGIN, "AIRPORT") !== FALSE){
echo "<tr><td colspan=\"1\" class=\"bold\">Airport:</td><td colspan=\"3\"><input type=\"HIDDEN\" name=\"P_ADDRESS\" value=\"".$row[ORIGIN]."\"><input type=\"text\" name=\"P_ADDRESS1\" value=\"".$row[ORIGIN]."\"disabled></td></tr>\n";
echo "<tr><td colspan=\"1\" class=\"bold\">Terminal:</td><td colspan=\"1\"><input type=\"text\" name=\"P_TERMINAL\" value=\"\"></td><td colspan=\"1\" class=\"bold\">Flight No:</td><td colspan=\"1\"><input type=\"text\" name=\"P_FLIGHTNO\" value=\"\"></td></tr>\n";}
else{
//location
echo "<tr><td colspan=\"1\" class=\"bold\">Address:</td><td colspan=\"3\"><input type=\"HIDDEN\" name=\"P_ADDRESS\" value=\"".$row[ORIGIN]."\"><input type=\"text\" name=\"P_ADDRESS1\"value=\"".$row[ORIGIN]."\" disabled></td>";}
echo "<tr class=\"title\" bgcolor=\"#4382b5\"><td colspan='4'>Destination Details</td></tr>\n";
$DESTINATION = $row[DESTINATION];
//postcode
if (IsPostcode($DESTINATION))
{echo "<tr><td colspan=\"1\" class=\"bold\">Address:</td><td colspan=\"1\"><input type=\"text\" name=\"D_ADDRESS\"></td>";
echo "<td colspan=\"1\" class=\"bold\">Postcode:</td><td colspan=\"1\"><input type=\"hidden\" name=\"D_POSTCODE\" value=\"".$row[DESTINATION]."\"><input type=\"text\" name=\"D_POSTCODE1\" value=\"".$row[DESTINATION]."\" disabled></td></tr>\n";}
//airport
else if (strpos($DESTINATION, "AIRPORT") !== FALSE){
echo "<tr><td colspan=\"1\" class=\"bold\">Airport:</td><td colspan=\"3\"><input type=\"HIDDEN\" name=\"D_ADDRESS\" value=\"".$row[DESTINATION]."\"><input type=\"text\" name=\"D_ADDRESS1\" value=\"".$row[DESTINATION]."\"disabled></td></tr>\n";}
else{
//location
echo "<tr><td colspan=\"1\" class=\"bold\">Address:</td><td colspan=\"3\"><input type=\"HIDDEN\" name=\"D_ADDRESS\" value=\"".$row[DESTINATION]."\"><input type=\"text\" name=\"D_ADDRESS1\"value=\"".$row[DESTINATION]."\" disabled></td>";}
[/insert_php]
Last edited by chris1990; Jan 20th, 2014 at 12:29 PM.
If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.
If you fail, try and try again, its the only way to success.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|