Jump to content

Recommended Posts

hello,

I have a problem with running php contat form on web...i tried to fix it but would't work..

I have 2 php files, will paste it below, i would be very gratefull if someone could help me to solve the problem, thanks

 

defectform.php

 

<html lang="en-gb">

<head>

<title><?php echo $browsertitle; ?></title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta name="robots" content="index,follow">

<meta http-equiv="Pragma" content="no-cache">

<meta name="author" content="www.nevada.ie">

<script language="JavaScript" type="text/JavaScript"

</head>

<body onLoad="MM_preloadImages('/imgs/buttons/profile.on.gif','/imgs/buttons/why.on.gif','/imgs/buttons/home.on.gif','/imgs/buttons/product.on.gif','/imgs/buttons/news.on.gif')">

<table width="774" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="bg">

  <tr>

    <td valign="top">

      <table width="774" border="0" cellspacing="0" cellpadding="0">

      <tr>

        <td><table width="760" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">

          <tr>

            <td><td>

          </tr>

          <tr>

            <td><table width="742" border="0" align="center" cellpadding="0" cellspacing="0">

                <tr>

                  <td width="95%" valign="top" class="paddingLeft10px"><table width="100%" border="0" cellpadding="5" cellspacing="0">

                      <tr>

                        <td valign="top" class="marginRight20px"><table width="725"  border="0" cellpadding="0" cellspacing="0">

                          <tr>

                       

                        </table>                       

                          <img src="imgs/titles/defet.gif" alt="DEFECT REPORT FORM" width="725" height="28">                          <h1><span class="alignTop">

                          <p><center><font size="=7"  color="#696969"> DEFECT/BREAKDOWN (TO BE COMPLETED BY SERVICE PROVIDER)</font></center></p>

 

<style type="text/css">

 

#inputbox{

border: 1px solid #000;

width: 200;

padding: 2px;

font-weight: bold;

font-family: Verdana, Arial;

font-size: 12px;

}

#inputlabel {

font-weight: bold;

font-family: Verdana, Arial;

font-size: 12px;

}

#textarea {

border: 1px solid #000;

padding: 2px;

font-weight: bold;

font-family: Verdana, Arial;

font-size: 12px;width:400;

}

#submitbutton {

border: 1px solid #000;

}

</style>

 

<script language="javascript">

function createRequestObject()

{

    var ro;

    var browser = navigator.appName;

    if(browser == "Microsoft Internet Explorer")

{

        ro = new ActiveXObject("Microsoft.XMLHTTP");

    }

else{

        ro = new XMLHttpRequest();

    } 

return ro;

}

 

var http = createRequestObject();

 

function sendemail()

{

var msg = document.contactform.msg.value;

var fleet number = document.contactform.fleet number.value;

var date = document.contactform.date.value;

var name = document.contactform.name.value;

var reported = document.contactform.reported.value;

var address = document.contactform.address.value;

var number = document.contactform.number.value;

var defect = document.contactform.defect.value;

var email = document.contactform.email.value;

var subject = document.contactform.subject.value;

document.contactform.send.disabled=true;

document.contactform.send.value='Sending....';

 

  http.open('get', 'contact.php?msg='+msg+'&fleet number='+fleet number+'&date='+date+'&name='+name+'&reported='+reported+'&address='+address+'&number='+number+'&defect='+defect+'&email='+email+'&subject='+subject+'&action=send');

 

  http.onreadystatechange = handleResponse; 

  http.send(null);}

 

function handleResponse()

{

    if(http.readyState == 4)

{

        var response = http.responseText;       

var update = new Array();     

  if(response.indexOf('|' != -1)) {

            update = response.split('|');           

document.getElementById(update[0]).innerHTML = update[1];

}    }}

 

</script>

</head>

<body>

<div id="contactarea">

<form name="contactform" id="contactform">

 

<span id="inputlabel"> Fleet Number:</span>      

<input type="text" name="fleet number" id="inputbox">   

 

<span id="inputlabel">Date:</span>                         

<input type="text" name="date" id="inputbox"><br /><br />

 

<span id="inputlabel">Customer Name:</span>  

<input type="text" name="name" id="inputbox">

   

 

<span id="inputlabel">Call Reported by:</span>      

<input type="text" name="reported" id="inputbox"><br /><br />

 

<span id="inputlabel"> Depot Address:</span>    

<input type="text" name="address" id="inputbox">

   

 

<span id="inputlabel">Registration Number:</span>

<input type="text" name="number" id="inputbox"><br /><br />

 

 

<span id="inputlabel">Defect Details:</span><br />

<textarea name="defect" rows="3" id="textarea"></textarea>

<br /><br />

 

<span id="inputlabel">Email:</span>     

<input type="text" name="email" id="inputbox"><br /><br />

 

<span id="inputlabel">Subject:</span>  

<input type="text" name="subject" id="inputbox"><br /><br />

 

<span id="inputlabel">Message:</span><br />

<textarea name="msg" rows="3" id="textarea"></textarea>

<br /><br />

 

<input type="button" value="Send Email" name="send" onClick="sendemail();" id="submitbutton">

</form>

</tr>

                    </table>

                      </td>

                </tr>

              </table></td>

          </tr>

        </table></td>

      </tr>

     

     

    </table></td>

  </tr>

</table>

</body>

</html>

 

contact.php

 

<?php

 

 

$to = "enricia@interia.ie";

$subject_prefix = "";

 

if(!isset($_GET['action']))

{

die("You must not access this page directly!");

}

 

 

$fleet number = trim($_GET['fleet number']);

$date = trim($_GET['date']);

$name = trim($_GET['name']);

$reported = trim($_GET['reported']);

$address = trim($_GET['address']);

$number = trim($_GET['number']);

$defect = trim($_GET['defect']);

$email = trim($_GET['email']);

$subject = trim($_GET['subject']);

$message = trim($_GET['msg']);

 

mail($to,$fleet number,$date,$reported,$address,$number,$defect,$subject,$message,"From: ".$email."");

 

echo 'contactarea|Thank you '.$name.', your email has been sent.';

?>

Link to comment
https://forums.phpfreaks.com/topic/175158-php-contact-form/
Share on other sites

i would be very gratefull if someone could help me to solve the problem, thanks

 

Well, what's the problem?

 

1) Use


tags.

2) Try to diagnose the problem yourself first so you can isolate where the issue lyes and only need to post the relevant code.

Link to comment
https://forums.phpfreaks.com/topic/175158-php-contact-form/#findComment-923175
Share on other sites

Also you may think about mail()

 

Looks to me like they're already using the mail function.

 

yes.... is more the way they are using it that I was suggesting they review the manual

mail($to,$fleet number,$date,$reported,$address,$number,$defect,$subject,$message,"From: ".$email.""); 

Link to comment
https://forums.phpfreaks.com/topic/175158-php-contact-form/#findComment-923971
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.