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

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.

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.

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'];

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.

Member Avatar for diafol

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.

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

Member Avatar for diafol

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.

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

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.

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";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.