PDA

View Full Version : PHP to ASP


macsolutions
10-22-2009, 04:00 PM
Hi, I have an HTML website on a MS Server with a PHP contact form, this is because I had to move this website from a Linux server as my other site is in ASP. The contact form does not work, as expected, and I would like to convert this over to ASP to make it work.

I have no knowledge what so ever in ASP and was hoping some kind soul could figure it out for me. I did convert it with an online converter but did not know how to save it as an ASP file.

html website: www.macsolutions.co.uk

CONVERTED PHP TO ASP FILE
<%
Dim gv_%>
?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Contact Form';

// Your email address. This is where the form information will be sent.
$emailadd = 'support@macsolutions.co.uk';

// Form Address.
$url = 'http://www.macsolutions.co.uk/contact us/contact us.html';

// Where to redirect after form is processed.
$url = 'http://www.macsolutions.co.uk/confirmation/confirmation.html';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?
%>


PHP FILE
?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Contact Form';

// Your email address. This is where the form information will be sent.
$emailadd = 'support@macsolutions.co.uk';

// Form Address.
$url = 'http://www.macsolutions.co.uk/contact us/contact us.html';

// Where to redirect after form is processed.
$url = 'http://www.macsolutions.co.uk/confirmation/confirmation.html';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>

Many Thanks
Tom

Hi, I have an HTML website on a MS Server with a PHP contact form, this is because I had to move this website from a Linux server as my other site is in ASP. The contact form does not work, as expected, and I would like to convert this over to ASP to make it work.

I have no knowledge what so ever in ASP and was hoping some kind soul could figure it out for me. I did convert it with an online converter but did not know how to save it as an ASP file.

html website: www.macsolutions.co.uk

CONVERTED PHP TO ASP FILE
<%
Dim gv_%>
?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Contact Form';

// Your email address. This is where the form information will be sent.
$emailadd = 'support@macsolutions.co.uk';

// Form Address.
$url = 'http://www.macsolutions.co.uk/contact us/contact us.html';

// Where to redirect after form is processed.
$url = 'http://www.macsolutions.co.uk/confirmation/confirmation.html';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?
%>


PHP FILE
?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Contact Form';

// Your email address. This is where the form information will be sent.
$emailadd = 'support@macsolutions.co.uk';

// Form Address.
$url = 'http://www.macsolutions.co.uk/contact us/contact us.html';

// Where to redirect after form is processed.
$url = 'http://www.macsolutions.co.uk/confirmation/confirmation.html';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');