This is a forum where members new and old can come to ask questions and get info and opinions. It is not a place to advertise your business or have other forms of advertising, whether it be in your posts or signature.

All links in the forum will not be indexed by Search Engines and any unapproved forms of advertising or spam will be dealt with accordingly, deleted, and that member's account banned.

Forums

Overview » PHP » Convert a java asp to php please, I am so stuck!
Reply

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

mark allison
Member



Since: 28 May 2010
Posts: 2
Posted 29 May 2010 01:59:46

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";


%>

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";


%>
Patrick Woldberg
Official Representative



Since: 11 Feb 2003
Posts: 1,894
Replied 16 Jun 2010 17:26:53
<?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');
?>
mark allison
Member



Since: 28 May 2010
Posts: 2
Replied 17 Jun 2010 19:06:20
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

Message
Reply
Follow us on Facebook Follow us on twitter Subscribe to the RSS feed
Activate your free membership today | Login | Currency