Jump to content

[SOLVED] no data being transferred with my php script


stupid girl!

Recommended Posts

Hi All

 

I am trying to use a php script to transmit data through a form. usually this form works fine, but im obviously missing something out. can anyone help?

 

 <?php
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) 
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n"; 
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
}
if(empty($firstname) || empty($email) || empty($cardnumber) || empty($lastname )) {
echo "<h2></h2>\n";
}

$todayis = date("l, F j, Y, g:i a") ;

$attn = $firstname ; 
$subject = "Request for Valuation from website" ; 

$notes = stripcslashes($notes); 

$message = " $todayis [EST] \n
Titla: $title \n
Name: $name \n 
Address1: $address1 \n 
Address2: $address2 \n 
postcode: $postcode \n
Telephone: $telephone \n
Mobile: $mobile \n
Email: $email \n
What is your Property Type: $proptype \n
Is your property on the market?: $propmarket \n
If so which agent?: $agent \n
How Much is it on the market for?: $cost \n
Do you wish to stay as a tenant: $tenant \n
Which of our options do you prefer?: $options \n
";

$from = "From: $email\r\n";
var address = 'info';
var domain = 'homesboughttoday';
var ext = 'co.uk'; 

mail("address+domain+ext", $subject, $message, $from);

?>

Link to comment
Share on other sites

ok, it has not been solved, there is still an isse where as the form responses are not sowing in the email.

 

belows is the form code

<form method="post" action="sendemail.php"><table width="85%" height="200" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td colspan="4" bgcolor="#FFFFFF"><div align="center" class="style13"> <?php $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); ?>
                                            <input type="hidden" name="ip" value="<?php echo $ipi ?>" />
                                            <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
                                            <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />Please complete the following form and one of our team will contact your shortly 
                <br /><br /></div></td>
            </tr>
          <tr>
            <td height="8" colspan="4" bgcolor="#999999"></td>
          </tr>
          <tr>
            <td width="13%" bgcolor="#FFFFFF"><div align="right" class="style13 style12"><strong>Title:</strong></div></td>
            <td width="24%" bgcolor="#FFFFFF"><input name="title" type="text" id="title" size="15" /></td>
            <td width="35%" bgcolor="#FFFFFF"><span class="style13 style12 style21"><strong>Property Type: </strong></span></td>
            <td width="28%" bgcolor="#FFFFFF"><span class="style13">
              <select name="proptype" id="proptype">
                <option value="Apartment / Flat">Apartment/Flat</option>
                <option value="Cottage">Cottage</option>
                <option value="Detached Bungalow">Detached bungalow</option>
                <option value="Detached House">Detached House</option>
                <option value="Link House">Link House</option>
                <option value="Maisonette">Maisonette</option>
                <option value="Semi Detached Bungalow">Semi detached Bungalow</option>
                <option value="Semi Detached House">Semi Detached house</option>
                <option value="Terraced House">Terraced house</option>
                <option value="Town House">Town House</option>
                <option value="Please Select" selected="selected">Please Select</option>
              </select>
            </span> </td>
          </tr>
          <tr>
            <td bgcolor="#FFFFFF"><div align="right" class="style13 style12"><strong>Name:</strong></div></td>
            <td bgcolor="#FFFFFF"><input name="firstname" type="text" id="firstname" size="15" /></td>
            <td bgcolor="#FFFFFF"><span class="style13 style12 style21"><strong>Is the Property on the Market? </strong></span></td>
            <td bgcolor="#FFFFFF"><span class="style13">
              <select name="propmarket" id="propmarket">
                <option value="Please Select">Please Select</option>
                <option value="Yes">Yes</option>
                <option value="No">No</option>
              </select>
            </span> </td>
          </tr>
          <tr>
            <td bgcolor="#FFFFFF"><div align="right" class="style13 style12"><strong>Address:</strong></div></td>
            <td bgcolor="#FFFFFF"><input name="address1" type="text" id="address1" size="15" /></td>
            <td bgcolor="#FFFFFF"><span class="style13 style12 style21"><strong>If so, with which agent? </strong></span></td>
            <td bgcolor="#FFFFFF"><input name="agent" type="text" id="agent" size="15" /></td>
          </tr>
          <tr>
            <td bgcolor="#FFFFFF"><div align="right"></div></td>
            <td bgcolor="#FFFFFF"><input name="address2" type="text" id="address2" size="15" /></td>
            <td bgcolor="#FFFFFF"><span class="style13 style12 style21"><strong>How much is it on the market for? </strong></span></td>
            <td bgcolor="#FFFFFF"><input name="cost" type="text" id="cost" size="15" /></td>
          </tr>
          <tr>
            <td bgcolor="#FFFFFF"><div align="right" class="style13 style12"><strong>Post Code: </strong></div></td>
            <td bgcolor="#FFFFFF"><input name="postcode" type="text" id="postcode" size="15" /></td>
            <td bgcolor="#FFFFFF"><span class="style13 style12 style21"><strong>Do you wish to stay as a tenant after sale? </strong></span></td>
            <td bgcolor="#FFFFFF"><span class="style13">
              <select name="tenant" id="tenant">
                <option value="Please Select">Please Select</option>
                <option value="Yes">Yes</option>
                <option value="No">No</option>
              </select>
            </span></td>
          </tr>
          <tr>
            <td bgcolor="#FFFFFF"><div align="right" class="style13 style12"><strong>Tel:</strong></div></td>
            <td bgcolor="#FFFFFF"><input name="telephone" type="text" id="telephone" size="15" /></td>
            <td bgcolor="#FFFFFF"> </td>
            <td bgcolor="#FFFFFF"> </td>
          </tr>
          <tr>
            <td bgcolor="#FFFFFF"><div align="right" class="style13 style12"><strong>Mobile:</strong></div></td>
            <td bgcolor="#FFFFFF"><input name="mobile" type="text" id="mobile" size="15" /></td>
            <td bgcolor="#FFFFFF"> </td>
            <td bgcolor="#FFFFFF"> <input name="submit" type="submit" value="Send Mail" /></td>
          </tr>
          <tr>
            <td bgcolor="#FFFFFF"><div align="right" class="style13 style12"><strong>Email:</strong></div></td>
            <td bgcolor="#FFFFFF"><input name="email" type="text" id="email" size="15" /></td>
            <td bgcolor="#FFFFFF"> </td>
            <td bgcolor="#FFFFFF"> </td>
          </tr>
          <tr>
            <td height="8" bgcolor="#666666"><span class="style12"></span></td>
            <td height="8" bgcolor="#666666"><span class="style12"></span></td>
            <td height="8" bgcolor="#666666"><span class="style12"></span></td>
            <td height="8" bgcolor="#666666"></td>
          </tr>
        </table>
            </form>

below is the php code

 <?php
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) 
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n"; 
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
}
if(empty($firstname) || empty($email) || empty($cardnumber) || empty($lastname )) {
echo "<h2></h2>\n";
}

$todayis = date("l, F j, Y, g:i a") ;

$attn = $firstname ; 
$subject = "Valuation form from Homes Bought Today" ; 

$notes = stripcslashes($notes); 

$message = " $todayis [EST] \n
Title: $title \n
Name: $firstname \n
Address1: $address1 \n 
Address2: $address2 \n 
Postcode: $postcode \n 
Telephone: $telephone \n
Mobile: $mobile \n
Email: $email \n
Type of Property: $proptype \n
Mobile: $mobile \n
Is your property on the market?: $propmarket \n
If so Which Agent?: $agent \n
How Much: $cost \n
Do you wish to stay as a tenant?: $tenant \n
From: $firstname ($email)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $email\r\n";


mail("joe@bloggs.com", $subject, $message, $from);

?>

 

this script is a copy of an exsiting working one. any ideas please?

Link to comment
Share on other sites

ok

 

Well i am also new and forgive me if i get anything wrong. $_post goes where you want to call inforamtion form the form. For example you have

Name: $firstname \n

which should read

Name: echo $_POST["firstname"]; 

 

The bit in the [  ] is the id name of the feild you want to copy across from the form. Change the whole php and it should work. Post any more problems.

Link to comment
Share on other sites

I am getting this error message: Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/homes/public_html/sendemail.php on line 146

 

    <?php
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) 
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n"; 
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
}
if(empty($firstname) || empty($email) || empty($cardnumber) || empty($lastname )) {
echo "<h2></h2>\n";
}

$todayis = date("l, F j, Y, g:i a") ;

$attn = $firstname ; 
$subject = "Valuation form from Homes Bought Today" ; 

$notes = stripcslashes($notes); 

$message = " $todayis [EST] \n
Title: $title \n
Name: echo $_POST["firstname"]; 
Address1: echo $_POST["address1"]; 
Address2: echo $_POST["address2"]
Postcode: echo $_POST["postcode"]
Telephone: echo $_POST["telephone"]
Mobile: echo $_POST["mobile"]
Email: echo $_POST["email"]
Type of Property: echo $_POST["proptype"]
Is your property on the market?: echo $_POST["propmarket"]
If so Which Agent?: echo $_POST["agent"]
How Much: echo $_POST["cost"]
Do you wish to stay as a tenant?: echo $_POST["tenant"]
From: $firstname ($email)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $email\r\n";


mail("joe@bloggs.com", $subject, $message, $from);

?>

Link to comment
Share on other sites

as i am new i am going to do some trouble shooting. This will help us both. Therefore bear with me.

 

 <?php
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) 
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n"; 
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
}
if(empty($firstname) || empty($email) || empty($cardnumber) || empty($lastname )) {
echo "<h2></h2>\n";
}

$todayis = date("l, F j, Y, g:i a") ;

$attn = $firstname ; 
$subject = "Valuation form from Homes Bought Today" ; 

$notes = stripcslashes($notes); 

$message = " $todayis [EST] \n
Title: $title \n
Name: echo $_POST["firstname"]; 
Address1: echo $_POST["address1"]; 
Address2: echo $_POST["address2"]
Postcode: echo $_POST["postcode"]
Telephone: echo $_POST["telephone"]
Mobile: echo $_POST["mobile"]
Email: echo $_POST["email"]
Type of Property: echo $_POST["proptype"]
Is your property on the market?: echo $_POST["propmarket"]
If so Which Agent?: echo $_POST["agent"]
How Much: echo $_POST["cost"]
Do you wish to stay as a tenant?: echo $_POST["tenant"]
From: $firstname ($email)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";
echo $message;
?>

 

I have just edited it by closing the php

Link to comment
Share on other sites

ok we shall try and go back to basics. Like from the form just load the values.

 

In the form are you sure action part is sending to the correct php file sendemail.php.

 

form method="post" action="sendemail.php">

 

change to

form action="post" action="sendemail.php">

 

Also in the sendemail.php we will go to basics.

 

<?php
echo $_POST["firstname"]; 
echo $_POST["address1"]; 
echo $_POST["address2"];
echo $_POST["postcode"];
echo $_POST["telephone"];
echo $_POST["mobile"];
echo $_POST["email"];
echo $_POST["proptype"];
echo $_POST["propmarket"];
echo $_POST["agent"];
echo $_POST["cost"];
echo $_POST["tenant"];
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.