Forums

PHP

This topic is locked

Convert a java asp to php please, I am so stuck!

Posted 29 May 2010 01:59:46
1
has voted
29 May 2010 01:59:46 mark allison posted:
Hello can anyone help convert this bit of code into php.

I tried some auto converters but it was no good. Please help

<% @language="javascript" %>

<%
var comp = Request("compname" + "";
var name = Request("name" + "";
var postcode = Request("pcode" + "";
var mail = Request("email" + "";
var phone = Request("telno" + "";
var testin = Request("testing" + "";
var ntest = Request("notest" + "";
var prem = Request("premises" + "";
var mess = Request("message" + "";


var importance = "1";
var from = " ";
var to = " " + "";
var subject = "Online Enquiry";

var message = "<strong>Company Name</strong>: " + comp + "\r\n" +
"<br><br><strong>Contact Name</strong>: " + name + "\r\n" +
"<br><br><strong>Postcode</strong>: " + postcode + "\r\n" +
"<br><br><strong>Email</strong>: " + mail + "\r\n" +
"<br><br><strong>Phone Number</strong>: " + phone + "\r\n" +
"<br><br><strong>Date Testing Required</strong>: " + testin + "\r\n" +
"<br><br><strong>Estimated No. of items to test</strong>: " + ntest + "\r\n" +
"<br><br><strong>Type of premises</strong>: " + prem + "\r\n" +
"<br><br><strong>Message</strong>: " + mess + "\r\n" ;


var mail = Server.CreateObject("CDO.Message";
var cfg = Server.CreateObject("CDO.Configuration";

cfg.Fields.Item("schemas.microsoft.com/cdo/configuration/sendusing") = 1;
cfg.Fields.Update();

mail.Configuration = cfg;



mail.From = from;
mail.To = to;
mail.Subject = subject;
mail.HTMLBody = message;
mail.Send();
Response.Redirect("thanks.htm";


%>

Replies

Replied 16 Jun 2010 17:26:53
16 Jun 2010 17:26:53 Patrick Woldberg replied:
<?php
$message = "<strong>Company Name</strong>: " . $_POST['compname'] . "\r\n" .
"<br><br><strong>Contact Name</strong>: " . $_POST['name'] . "\r\n" .
"<br><br><strong>Postcode</strong>: " . $_POST['pcode'] . "\r\n" .
"<br><br><strong>Email</strong>: " . $_POST[email] . "\r\n" .
"<br><br><strong>Phone Number</strong>: " . $_POST['telno'] . "\r\n" .
"<br><br><strong>Date Testing Required</strong>: " . $_POST['testing'] . "\r\n" .
"<br><br><strong>Estimated No. of items to test</strong>: " . $_POST['notest'] . "\r\n" .
"<br><br><strong>Type of premises</strong>: " . $_POST['premises'] . "\r\n" .
"<br><br><strong>Message</strong>: " . $_POST['message'] . "\r\n" ;

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: Sales <Sales@powersonic-online.co.uk>' . "\r\n";
$headers .= 'From: Support <support@powersonic-online.co.uk>' . "\r\n";

// Mail it
mail('Sales@powersonic-online.co.uk', 'Online Enquiry', $message, $headers);

// Redirect
header('Location: thanks.htm');
?>
Replied 17 Jun 2010 19:06:20
17 Jun 2010 19:06:20 mark allison replied:
Thank you so much, I was really stuck on this.

Worked 1st time, you are a true gentleman!

All the best

Mark

Reply to this topic