0

Hi,

i moved my site to a new server yesterday and my booking form is not working since then.

I have html pages with a form action button as below;

<form action="http://mydomain.com/tour_form.php" method="post" style="margin:0 0 0 0;">
<br>
<input name="tn" type="hidden" value="product name">

<input type="submit" class="book" value="book now">
</form>


and this goes to the tour_form.php page where there is a php code as <?=$tn;?> which meant to get the name of the product from previous page but and writes it on top of the next page (tour_form.php) as well as it into a booking form so we know which product customer inquiry but it doesn't work since I moved it to a new server.

Can you please advise what I am doing wrong.

Thanks

5
Contributors
10
Replies
11
Views
6 Years
Discussion Span
Last Post by urtrivedi
0

Does your server allow short tag <?= 'something'; ?> Try to replace this statement <?=$tn;?> to <?php echo$tn; ?> , and check does any output returns. If so, your server's PHP setting does not allow for short tag.

0

Does your server allow short tag <?= 'something'; ?> Try to replace this statement <?=$tn;?> to <?php echo$tn; ?> , and check does any output returns. If so, your server's PHP setting does not allow for short tag.

Thanks! this didn't help - it is still the same can't write it.

0

You means '$tn' is for the variable from the form ? You form uses POST method, not GET. I'm not sure what you are doing with '$tn'. Maybe, you're wrong with '$_POST' var and '$_GET' vars. Try with below

$tn = $_POST['tn'];
0

You means '$tn' is for the variable from the form ? You form uses POST method, not GET. I'm not sure what you are doing with '$tn'. Maybe, you're wrong with '$_POST' var and '$_GET' vars. Try with below

$tn = $_POST['tn'];

sorry, i am not familiar with php. where do i use the above code?

just to make it clear 3 pages involve in this booking process;

1. page - product page with a post button form action="http://mydomain.com/tour_form.php" method="post" style="margin:0 0 0 0;">
<br>
<input name="tn" type="hidden" value="product name">

<input type="submit" class="book" value="book now">
</form>

2. page - booking form for the customer to fill in and I have
<?=$tn;?>

3. page - booking process form.

there is no problem with the last page but because of <?=$tn;?>
variable isn't coming accross to the booking form it's not working.

thanks for your help again.

0

Perhaps your directory info has changed? If you don't show your code, we can only guess that it's a problem with line 146 and again with line 175.

sorry, i am not familiar with php. where do i use the above code?

Well it would help if you understood a *bit* if you need to understand any solutions offered. Unless you expect a member to write everything for you, you'll need to bone up on php 101 to get YOUR site working.

0

here is all related codes;

first page

<form action="http://domain.com/tour_form.php" method="post" style="margin:0 0 0 0;">
                            <input name="tn" type="hidden" value="product name ">
			  <input type="submit" class="book" value="Book Now">
              </form>

second page - booking form

<form action="proccess_form.php3" method="post">
              <input name="td" type="hidden" value="<?php echo$tn; ?>">
			  <input type="hidden" name="tour_link" value="<?=$_SERVER['HTTP_REFERER'];?>">

last page - process the booking form
<?php
function CheckSecure() {
global $_POST,$_SESSION;
if($_POST|| $_GET) return 1;
if(!$_POST) return 0;
if(strtoupper($_POST) != strtoupper($_SESSION)) return 0;
session_unregister("verification_code");
return 1;
}
if(!CheckSecure()) {
echo "<b style=\"color:red\">!!!Error</b><br>Security code is invalid, please go back and try again ";
exit();
}
if($email && $name) {
$tour_link = $tour_link ? "<a href=\"$tour_link\">$td</a>" : $td;
$data="<html> <head>


and very top of the page I have
<?php if (!isset($_SESSION)){session_start();}?>

thanks for your help

0

You need a session_start() anyway.

global $_POST,$_SESSION;

No need for this - they are global in this context anyway.

<?php echo$tn; ?>

Put a space between echo and $tn.

0

php versioning error ??
the new host has a later version of php than the old host
there is nothing getting $email $name $tour_link from the $_post array
version>php5.20 shouldnt they be declared somewhere

$email=$_post['email'];
$name=$_post['name'];
$tour_link=$_post['tour-link'];

or refer directly to the _post array value

Edited by almostbob: n/a

0

Hi everyone,

I tried a few other thing with no joy - still my e-mail script isn't working.

I've attached all pages and I've got below statement from my hosting company.
Hello,
You need to check your email script again, so that it follows the guidelines for our shared service.

We made a change to our system that forces all email sent from our customer accounts to be checked for spoofing. Due to this measure, you can no longer send emails that appear to be from an email address that is not on your account.
Therefore, if you have a contact form or email program that attempts to set the "From:" header to anything but an email address that exists in your bluehost account, the mail will be rejected by our spoofing filter.

If you are sending email through SMTP, you must connect to "localhost" to send your email. Remote SMTP connections are no longer allowed from our servers and you must use AUTH when you connect to the SMTP.

Lastly, there is only one other change you should be aware of. Our mail system will not allow this header:

From: email@domain <email@domain.com>

Even if the email is valid, our system will fail the message due to the double declaration of the email address.


Thanks for your help.

Attachments
<?php
session_start();
?>
<?php $tn = $_POST['tn']; ?><html><head><title><?php echo $tn;?>Delivered</title>
</head>

<body>
<strong>
<?php
function CheckSecure() {
if($_POST['tel2']|| $_GET['tel2']) return 1;
if(!$_POST['verify']) return 0;
if(strtoupper($_POST['verify']) != strtoupper($_SESSION['verification_code'])) return 0;
session_unregister("verification_code");
return 1;
}
if(!CheckSecure()) {
echo "<b style=\"color:red\">!!!Error</b><br>Security code is invalid, please go back and try again ";
exit();
}
if($email && $name) {
$tour_link = $tour_link ? "<a href=\"$tour_link\">$td</a>" : $td;
$data="<html> <head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
</head>
<body bgcolor='#ffffff' text='#000000'>
<table name=tarihform border=1 width=427 cellpadding='1' cellspacing='0' bordercolorlight='#9E9E9E' bordercolordark='#FFFFFF' bgcolor='#EEEEEE' align='center'>
<tr> <td colspan='2' class='footer' bgcolor='#EEEEEE' height='37' align='center'><br>
<font size='3'><b><font size='2'> Online Request Form</font></b></font>
<br></tr> <tr> <td class='footer' bgcolor='#EEEEEE' width='163' align='right' height='27'>
<font size='2'>Choosen  Tour : </font></td>
<td class='footer' width='254' bgcolor='#FFFFFF' height='27'><font color='#FF0000' size='2'>
$tour_link </font></td></tr><tr>
<td class='footer' bgcolor='#EEEEEE' width='163' align='right' height='27'><font size='2'>Name:
</font></td><td class='footer' width='254' bgcolor='#FFFFFF' height='27'><font color='#FF0000' size='2'>
$name </font></td> </tr><tr>
<td class='footer' bgcolor='#EEEEEE' width='163' align='right' height='27'><font size='2'>e-mail
address : </font></td>
<td class='footer' width='254' bgcolor='#FFFFFF' height='27'><font color='#FF0000' size='2'>
$email </font></td></tr><tr>
</tr><tr>  <td class='footer' bgcolor='#EEEEEE' width='163' align='right' height='27'><font size='2'>Country:
</font></td><td class='footer' width='254' bgcolor='#FFFFFF' height='27'>
<font size='2' face='Verdana' color='#FF0000'> $country</font></td>
</tr><tr>
<td class='footer' bgcolor='#EEEEEE' width='163' align='right' height='27'><font size='2'>Telephone:
</font></td> <td class='footer' width='254' bgcolor='#FFFFFF' height='27'>
<font color='#FF0000' size='2'> $telephone </font></td>
</tr> <tr> <td class='footer' bgcolor='#EEEEEE' width='163' align='right' height='27'>
<font size='2'>Arrival Date: </font></td>
<td class='footer' width='254' bgcolor='#FFFFFF' height='27'><font color='#FF0000' size='2'>
$startmonth - $startday - $startyear </font></td> </tr><tr>
<td class='footer' bgcolor='#EEEEEE' width='163' align='right'><font size='2'>
Departure Date: </font></td>
<td width='254' bgcolor='#FFFFFF'><font color='#FF0000' size='2'>
$startmonth1 - $startday1 - $startyear1 </font></td></tr>
</tr> <tr> <td class='footer' bgcolor='#EEEEEE' width='163' align='right'>
<font size='2'>No of Adults / Child - Age :</font></td>
<td width='254' bgcolor='#FFFFFF'><font color='#FF0000' size='2'>
$numberofperson  - $child - $age </font></td></tr>
<tr> <td class='footer' bgcolor='#EEEEEE' width='163' align='right'>
<font size='2'>Hotel Type :</font></td>
<td width='254' bgcolor='#FFFFFF'><font color='#FF0000' size='2'>
$hoteltype</font></td></tr>
<tr>
<td class='footer' bgcolor='#EEEEEE' width='163' align='right' >
<font size='2'>Comments </font></td>
<td class='footer' width='254' bgcolor='#FFFFFF'><font color='#FF0000' size='2'>
$comment </font></td></tr></table></body></html>";
$header = "From: $name \n";
$header .= "Content-Type: text/html; charset=iso-8859-9\n";
$header .= "X-Sender: <support@mydomain.com>\n";
$header .= "X-Mailer: PHP\n";
$header .= "X-Priority: 1\n";
$header .= "Return-Path: <support@mydomain.com><info@mydomain.com>\n";
mail("support@mydomain.com, info@mydomain.com ", "$td", "$data", "$header");
echo("Dear $name $surname <br><br>  $td inquiry has been delivered. <br><br>We will review your request and get back to you as soon as possible. <br><br>Phone : +52523452435 up to 69 <br><br>Fax : +24523452342<br><br> Thank you.<br><br> Company
");
}
elseif ($name) {
echo("Please write down your email.");
}
elseif ($send) {
echo("The form can`t be sent, please try again!");
echo("<br>");
echo("<hr size=\"1\">");
}
else echo("Error: Please fill completly the form.");
?>
</strong>
</body>
</html>
<?
session_start();
?><?
$error_occured = 0;
if(!session_start()) $error_occured = 1;
class imagecl {
var $image;
var $im_w;
var $im_h;
var $textcolor;
var $bgcolor;
var $ttf_font;
var $code = "";
function GetCode() { return $code; }
function imagecl($width=120,$height=40,$font="") {
$this->im_w = $width;
$this->im_h = $height;
$this->ttf_font = $font;
}
function Init() {
$this->image = imagecreate($this->im_w,$this->im_h);
$this->set_bgcolor(198,198,168);
$this->set_textcolor(0,0,91);
}
function set_bgcolor($r,$g,$b) {
$background_color = imagecolorallocate($this->image,$r,$g,$b);
}
function set_textcolor($r,$g,$b) {
$this->textcolor = imagecolorallocate($this->image,$r,$g,$b);
}
function Draw() {
global $error_occured;
if($error_occured) $code = "Error Occured";
else  $code =$this->GenerateCode();
$this->RegisterCode($code);
$x = 2;
$y = 20;
for($i=0; $i < strlen($code); $i++) {
$calc_y = rand(200,250) / 10;
$angle  = rand(-18,18);
$this->WriteString($x,$calc_y,$angle,$code[$i]);
$x += rand(21,23);
}
}
function GenerateCode() {
$string = md5(rand(0,999));
$output = substr($string,14,6);
return strtoupper($output);
}
function RegisterCode($code) {
$_SESSION['verification_code'] = $code;
}
function WriteString($x_off,$y_off,$angle,$string) {
if($this->ttf_font == "") { echo "no font defined"; return; }
$fontsize = 18;
$grey = imagecolorallocate($this->image, 128, 128, 128);
imagettftext($this->image,$fontsize,$angle,$x_off+1,$y_off+1,$grey,$this->ttf_font,$string);
imagettftext($this->image,$fontsize,$angle,$x_off,$y_off,$this->textcolor,$this->ttf_font,$string);
}
function Output() {
$this->Init();
$this->Draw();
header("Content-type: image/png");
imagepng($this->image);
imagedestroy($this->image);
}
}
$im = new imagecl(140,45,realpath("DESTROY_.TTF"));
$im->Output();
?>
<?php $tn = $_POST['tn']; ?>
<html>
<head>
<title>Check  Availability <?php echo $tn; ?></title>
</HEAD>

<body>
<table width=473 height="632" border=0 cellpadding="0" cellspacing="0" bordercolorlight="#9E9E9E" bordercolordark="#FFFFFF" name=tarihform>
  <form action="proccess_form.php" method="post">
    <input name="td" type="hidden" value="<?php $tn = $_POST['tn']; ?>
			  <input type="hidden>
    <tr>
      <td width="193" height="27" align="right" valign="top" class="main"><div align="left"><strong>Name &amp; Surname</strong></div>
      </td>
      <td width="15" valign="top"><strong>: </strong></td>
      <td width="265" height="27" valign="top" class="footer">
        <input name="name" type="text" id="name3" size="28">
        <br>
        <br>
      </td>
    </tr>
    <tr>
      <td width="193" align="right" valign="top" class="main"><div align="left"><strong>e
            - mail </strong></div>
      </td>
      <td width="15" valign="top"><strong>:</strong></td>
      <td width="265" height="27" valign="top" class="footer">
        <input name="email" type="text" id="email" size="28">
        <br>
        <br>
      </td>
    </tr>
    <tr>
      <td valign="top" class="main"><strong>Country</strong></td>
      <td valign="top"><strong>:</strong></td>
      <td height="44" valign="top"><select name="country" size="1"id="country">
          <option selected>Please Select Country
          <option>Afganistan
          <option>Albania
          <option>Algeria
          <option>American Samoa
          <option>Andorra
          <option>Angola
          <option>Anguilla
          <option>Antigua
          <option>Argentina
          <option>Armenia
          <option>Australia
          <option>Austria
          <option>Azerbaijan
          <option>Bahamas
          <option>Bahrain
          <option>Bangladesh
          <option>Barbados
          <option>Belarus
          <option>Belgium
          <option>Belize
          <option>Benin
          <option>Bermuda
          <option>Bhutan
          <option>Bolivia
          <option>Botswana
          <option>Brazil
          <option>Bulgaria
          <option>Burkina Faso
          <option>Burma
          <option>Burnei
          <option>Burundi
          <option>Cambodia
          <option>Cameroon
          <option>Canada
          <option>Canary Islands
          <option>Cape Verde
          <option>Cayman Islands
          <option>Chad
          <option>Chile
          <option>China, Peop. Rep of
          <option>Colombia
          <option>Comoros
          <option>Congo, Peop Rep of
          <option>Cook Islands
          <option>Costa Rica
          <option>Croatia
          <option>Cyprus
          <option>Czech Republic
          <option>Denmark
          <option>Djibouti
          <option>Dominica
          <option>Dominican Republic
          <option>Ecuador
          <option>Egypt
          <option>El Salvador
          <option>Equatorial Guinea
          <option>Estonia
          <option>Ethiopia
          <option>Faeroe Islands
          <option>Falkland Islands
          <option>Fiji
          <option>Finland
          <option>France
          <option>French Guiana
          <option>French Polynesia
          <option>Gabon
          <option>Gambia
          <option>Georgia
          <option>Germany
          <option>Ghana
          <option>Gibraltar
          <option>Greece
          <option>Greenland
          <option>Guadeloupe
          <option>Guam
          <option>Guatemala
          <option>Guernsey Isle
          <option>Guinea
          <option>Guinea-Bissau
          <option>Guyana
          <option>Haiti
          <option>Holland
          <option>Honduras
          <option>Hong Kong
          <option>Hungary
          <option>Iceland
          <option>India
          <option>Indonesia
          <option>Ireland
          <option>Ireland, Rep of
          <option>Israel
          <option>Italy
          <option>Ivory Coast
          <option>Jamaica
          <option>Japan
          <option>Kampuchea (Cambodia)
          <option>Kazakhstan
          <option>Kenya
          <option>Kiribati
          <option>Korea, Rep of
          <option>Kuwait
          <option>Kyrgyzstan
          <option>La Reunion
          <option>Laos
          <option>Latvia
          <option>Lebanon
          <option>Lesotho
          <option>Liberia
          <option>Liechtenstein
          <option>Lithuania
          <option>Luxembourg
          <option>Macao
          <option>Madagascar
          <option>Malawi
          <option>Malaysia
          <option>Maldives
          <option>Mali
          <option>Malta
          <option>Mauritania
          <option>Mauritius
          <option>Mayotte
          <option>Mexico
          <option>Micronesia
          <option>Monaco
          <option>Mongolia
          <option>Montenegro
          <option>Montserrat
          <option>Morocco
          <option>Mozambique
          <option>Muldovia
          <option>Namibia
          <option>Nauru
          <option>Nepal
          <option>Netherlands
          <option>Netherlands Ant.
          <option>New Caledonia
          <option>New Hebrides
          <option>New Zealand
          <option>Nicaragua
          <option>Niger
          <option>Nigeria
          <option>Norway
          <option>Oman
          <option>Pakistan
          <option>Panama
          <option>Papua New Guinea
          <option>Paraguay
          <option>Peru
          <option>Philippines
          <option>Poland
          <option>Portugal
          <option>Puerto Rico
          <option>Qatar
          <option>Romania
          <option>Russia
          <option>Rwanda
          <option>Samoa
          <option>San Marino
          <option>Sao Tome &amp; Principe
          <option>Saudi Arabia
          <option>Scotland, UK
          <option>Senegal
          <option>Serbia
          <option>Seychelles
          <option>Sierra Leone
          <option>Singapore
          <option>Slovak Republic
          <option>Slovenia
          <option>Solomon Islands
          <option>Somalia
          <option>South Africa
          <option>Spain
          <option>Sri Lanka
          <option>St. Helena
          <option>St. Kitts - Nevis
          <option>St. Lucia
          <option>St. Pierre &amp; Miquelo
          <option>St. Vincent
          <option>Suriname
          <option>Swaziland
          <option>Sweden
          <option>Switzerland
          <option>Taiwan
          <option>Tajikstan
          <option>Tanzania
          <option>Thailand
          <option>Togo
          <option>Tonga
          <option>Trinidad and Tobago
          <option>Tunisia
          <option>Turkey
          <option>Turkmenistan
          <option>Turks and Caicos
          <option>Uganda
          <option>Ukraine
          <option>United Arab Emirates
          <option>United Kingdom
          <option>Uruguay
          <option>USA
          <option>Uzbekistan
          <option>Vanuatu
          <option>Vatican City State
          <option>Venezuela
          <option>Vietnam
          <option>Virgin Islands (Br.)
          <option>Wallis &amp; Fortuna Is.
          <option>Yemen, Peop. Rep. of
          <option>Zaire
          <option>Zambia
          <option>Zimbabwe
        </select>
          <br>
      </td>
    </tr>
    <tr>
      <td width="193" align="right" valign="top" class="main"><div align="left"><strong>Telephone</strong></div>
      </td>
      <td width="15" valign="top"><strong>:</strong></td>
      <td width="265" height="27" valign="top"><input name="telephone" type="text" id="telephone" size="28">
          <br>
      </td>
    </tr>
    <tr>
      <td height="50" align="right" valign="top" class="main"><div align="left"><strong> Arrival
            Date</strong></div>
      </td>
      <td valign="top"><strong>:</strong></td>
      <td valign="top">
        <?php

	$startmonth =(date ('F'));

	$startday =(date ('d'));

	$startyear =(date ('Y'));
	$startyear5 =(date ('Y')+1);
	$startyear7 =(date ('Y')+2);

	print ("



      <select name='startmonth'>

        <option selected value='$startmonth'>$startmonth 

        <option value='1'>January 

        <option value='2'>February 

        <option value='3'>March 

        <option value='4'>April 

        <option value='5'>May 

        <option value='6'>June 

        <option value='7'>July 

        <option value='8'>August 

        <option value='9'>September 

        <option value='10'>October 

        <option value='11'>November 

        <option value='12'>December 

      </select>

      <select name='startday'>

        <option value='$startday'>$startday 

        <script> 

 for(var i=1;i<=31;i++) { 

  document.write('<OPTION VALUE='+i+'>'+i);

   

 } 

</script>

      </select>

      <select name='startyear' size='1'>

        <option value='$startyear'>$startyear</option>
		<option value='$startyear5'>$startyear5</option>
		<option value='$startyear7'>$startyear7</option>

      </select>



");

?>
      </td>
    </tr>
    <tr>
      <td width="193" height="50" align="right" valign="top" class="main"><div align="left"><strong>Departure
            Date </strong></div>
      </td>
      <td width="15" valign="top"><strong>:</strong></td>
      <td width="265" valign="top"><?php

	$startmonth1 =(date ('F'));

	$startday1 =(date ('d')+1);

	$startyear1 =(date ('Y'));
	$startyear5 =(date ('Y')+1);
	$startyear7 =(date ('Y')+2);

	print ("



      <select name='startmonth1'>

        <option selected value='$startmonth1'>$startmonth1 

        <option value='1'>January 

        <option value='2'>February 

        <option value='3'>March 

        <option value='4'>April 

        <option value='5'>May 

        <option value='6'>June 

        <option value='7'>July 

        <option value='8'>August
0

line number 69 in process_form2.php

$header = "From: $name \n";

I think they will not allow any name. you must write some email id that you have registered with them.

so you code must look like

$header = "From: registered_with_bluehost@domain.com \n";
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.