Avatar of luvskyline
luvskyline
 asked on

convert ASP to PHP

i am an ASP beginner and have developed a feedback form using ASP but later got to know that my linux server does not support ASP ! how can i convert it into PHP? i have no knowledge in PHP.

Thank you.
PHP

Avatar of undefined
Last Comment
rascalpants

8/22/2022 - Mon
harwantgrewal

Hi there here is the solution for you

http://asp2php.naken.cc/download.php

I havent used this software but it will do your job

Harry
us111

ASP under unix (but some ASP functions or types do not work)
http://www.chilisoft.com
rascalpants

If you post the code, I can probably change it from ASP to PHP...  the above programs are pretty inaccurate... or cost money...

I would just take a look at a few PHP tutorials....

here is the basics that you will need to know/do:

- get rid of the dim variables...
- make sure all of your variable have a $ in front of them
- if you are using a DB to store the feedback info, then you will need to change out the Access stuff to MySQL

PHP is pretty simple once you get a feel for it... it also gives you better error messages...

post your code...

rp
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
luvskyline

ASKER
Total pages :3

first page  : contactus.asp


<html>
<head>
<title>Batt Broadbent-Solicitors-Salisbury</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script LANGUAGE="JavaScript">
<!--
function  checkIt(input)
                 {      
              if (document.form1.name.value == "") {
                             document.form1.name.focus()
                           alert("Please enter your name");
                           return false;
              }      
              if (document.form1.address1.value == "") {
                             document.form1.address1.focus()
                           alert("Please enter your address");
                           return false;
              }      
              if (document.form1.postcode.value == "") {
                             document.form1.postcode.focus()
                           alert("Please enter your Postcode");
                           return false;
              }      
              if (document.form1.email.value == "") {
                             document.form1.email.focus()
                           alert("Please enter a Email Address");
                           return false;
              }      
              
              /*if(txtUserMail.value.search(/[\w]+(\.[\w]+)?\@+[\w]+\.[\w]+(\.[\w]+)?/) < 0)*/
              if((document.form1.email.value.indexOf("@") == -1) || (document.form1.email.value.indexOf(".") == -1)) {
                        alert("Please enter a valid email address. e.g myname@domain.com");
                        document.form1.email.focus();
                        return false;
              }                  
              if(document.form1.email.value.indexOf("%") > -1 || document.form1.email.value.indexOf("'") > -1) {
                        alert("The email cannot contain special characters");
                        document.form1.email.focus();
                        return false;
              }            
              return true;
              }
// -->

</script>

<style type="text/css">
 A:link {font-family:Times New Roman;font-size:11px; color:#000000;text-decoration:none;}
 A:visited{font-family:Times New Roman;font-size:11px; color:#990000;text-decoration:none;}
 A:hover {font-family:Times New Roman;font-size:11px; color:#990000;text-decoration:underline;}</style>
</head>

<body bgcolor="#FFFFE2">
<div align="center">
  <table width="95%" border="0" height="100%">
    <tr>
      <td width="200" valign="top" height="426">
        <div align="left">
          <p> <img src="logo.gif" width="160" height="187" border="0">
          </p>
          <p>&nbsp;</p>
          <table width="90%" border="0">
            <tr>
              <td><font face="Times New Roman, Times, serif" size="3"><img src="bullet.gif" width="8" height="8"></font></td>
              <td><a href="file:///E%7C/Shadowpuppet/clients/Battbroadbent/html/index.html"><b><font size="-1">HOME</font></b></a></td>
            </tr>
            <tr>
              <td><font face="Times New Roman, Times, serif" size="3"><img src="bullet.gif" width="8" height="8"></font></td>
              <td><font face="Times New Roman" size="-1"><b><a href="file:///E%7C/Shadowpuppet/clients/Battbroadbent/html/conveyancing.html">PRACTICE
                AREA</a></b></font></td>
            </tr>
            <tr>
              <td><font face="Times New Roman, Times, serif" size="3"><img src="bullet.gif" width="8" height="8"></font></td>
              <td><b><font face="Times New Roman" size="-1"><a href="file:///E%7C/Shadowpuppet/clients/Battbroadbent/html/solicitors.html">SOLICITORS</a></font></b></td>
            </tr>
            <tr>
              <td><font face="Times New Roman, Times, serif" size="3"><img src="bullet.gif" width="8" height="8"></font></td>
              <td><b><font face="Times New Roman" size="-1"><a href="file:///E%7C/Shadowpuppet/clients/Battbroadbent/html/whereweare.html">WHERE
                WE ARE</a></font></b></td>
            </tr>
          </table>
         
        </div>
      </td>
      <td valign="top" height="426">
        <form name="form1" method="post" action="termsnconditions.asp">
       
        <p>In completing and submitting this form we undertake to response within
          2 working days telling you:</p>
        <p><img src="bullet.gif">&nbsp; what you need to do<br>
        <img src="bullet.gif">&nbsp; what we can offer<br>
        <img src="bullet.gif">&nbsp; how much it is likely to cost you</p>
        <p>Please supply the information bellow:</p>
          <table width="491" border="0">
            <tr>
              <td width="135">NAME<font color="#FF0000" size="2">*</font></td>
              <td width="342">
                <input type="text" name="name" size="40">
              </td>
            </tr>
            <tr>
              <td width="135">COMPANY</td>
              <td width="342">
                <input type="text" name="company" size="40" maxlength="50">
              </td>
            </tr>
            <tr>
              <td width="135">ADDRESS<font color="#FF0000" size="2">*</font></td>
              <td width="342">
                <input type="text" name="address1" size="40">
              </td>
            </tr>
            <tr>
              <td width="135">&nbsp;</td>
              <td width="342">
                <input type="text" name="address2" size="40">
              </td>
            </tr>
            <tr>
              <td width="135">&nbsp;</td>
              <td width="342">
                <input type="text" name="address3" size="40">
              </td>
            </tr>
            <tr>
              <td width="135">POST CODE<font color="#FF0000" size="2">*</font></td>
              <td width="342">
                <input type="text" name="postcode" size="20">
              </td>
            </tr>
            <tr>
              <td width="135">EMAIL ADDRESS<font color="#FF0000" size="2">*</font></td>
              <td width="342">
                <input type="text" name="email" size="40">
              </td>
            </tr>
            <tr>
              <td width="135">DEPARTMENT</td>
              <td width="342">
                <select name="dept" size="1">
                  <option selected>Please Select</option>
                  <option>Conveyancing and Property Law</option>
                  <option>Business Matters</option>
                  <option>Wils and Estate Administraiton</option>
                  <option>Disputes, Injury Claims or Family Law</option>
                </select>
              </td>
            </tr>
            <tr>
              <td width="135">QUESTION</td>
              <td width="342">
                <textarea name="question" cols="40" rows="3"></textarea>
              </td>
            </tr>
          </table>
          <p><font color="#FF0000" size="2">*</font> Required</p>
          <p>
            <input type="submit" value="Submit" name="Submit" onclick="return checkIt(this)">
            <input type="reset" name="Reset" value="Reset">
          </p>
        </form>
        <p align="left">&nbsp;</p>
        <p>&nbsp;</p>
        </td>
    </tr>
    <tr>
      <td width="200" valign="top" height="3">
        <p><font face="Times New Roman, Times, serif" size="-1"><br>
          &nbsp; </font></p>
        </td>
      <td height="3">&nbsp; </td>
    </tr>
  </table>
</div>
</body>
</html>



second page: termsncondition.asp

<%response.buffer = True%>
<html>
<head>
<title>Batt Broadbent-Solicitors-Salisbury</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">

</style>
<style type="text/css">
 A:link {font-family:Times New Roman;font-size:11px; color:#000000;text-decoration:none;}
 A:visited{font-family:Times New Roman;font-size:11px; color:#990000;text-decoration:none;}
 A:hover {font-family:Times New Roman;font-size:11px; color:#990000;text-decoration:underline;}</style>
 <script language="JavaScript">
<!--
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>

<body bgcolor="#FFFFE2">

<div align="center">
  <table width="669" border="0" height="100%">
    <tr>
      <td width="100" valign="top" height="420">
 <img border="0" src="logosmaller.gif" width="80" height="93">
       
                <p><font size="2">

                </font>
</p>
       
 <p>&nbsp;
      </td>
      <td valign="top" height="420" width="39">

        </td>
      <td valign="top" height="420" width="937">

<p align="center"><b>

Your Information:<br>
</b><font size="1" color="#800000">(Click the 'Back' button on your navigator's&nbsp;
                window to edit your information)<br>
</font>
                <form name="" method="post" action="feedbacksend.asp">
<p align="left"><font size="2">
<%
dim isElem
for Each isElem in Request.Form
%>

<%=isElem%>:       <%=request.form(isElem)%>
<input type="hidden" name="<%=isElem%>" value="<%=request.form(isElem)%>">
<br>
<%next%>
</font>
</form>
             
                <p><font size="2">In submitting this form you will be bound by our Terms and
                Conditions.&nbsp; Do you wish to continue?</font></p>
             
          <p align="right">
            <font size="2">
            <input type="submit" value="Continue" name="submit"> &nbsp;&nbsp; <a href="http://www.geocities.com/ennydurman/battbroadbent/html/index.html"><input type="button" name="Button" value="Back to Home" onClick="MM_goToURL('parent','index.html');return document.MM_returnValue">
            </a>
            </font>
          </p>
             <p align="left"><b>
             Terms and Conditions</b></p>
              <p><font size="2">Batt Broadbent Terms and Conditions bla....bla....</font></p>
              <p>&nbsp;</p>
             
             <p align="center">&nbsp;</p>
             <p>&nbsp;</p>
       
        <p align="left">&nbsp;</p>
        <p align="left"><b>
    </b></p>
        </td>
    </tr>
  </table>
</div>
</form>
</html>


third page: feedbacksend.asp


<html>
<head>

<title>Welcome to Batt Broadbent-Solicitors-Salisbury</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
 A:link {font-family:Times New Roman;font-size:11px; color:#000000;text-decoration:none;}
 A:visited{font-family:Times New Roman;font-size:11px; color:#990000;text-decoration:none;}
 A:hover {font-family:Times New Roman;font-size:11px; color:#990000;text-decoration:underline;}</style>
<script language="JavaScript">
</script>

</head>
<%
                  If request("submit") <> "" then
                        SendRegistration
                  Else
                        response.write "Error. Please check with your administrator"
                  End if
                  %>


<body topmargin="0" marginheight="0" bgcolor="#FFFFE2">

<form name="form" method="post" action="">
   <table width="605" border="0" cellspacing="0" cellpadding="0" align="center" height="438">
    <tr background="../images/backgd.jpg">
      <td valign="top" height="113" colspan="2" width="654">
        <p align="center"><img border="0" src="logo.gif" width="160" height="187"></p>
      </td>
    </tr>
    <tr>
      <td valign="top" height="304" width="581"><table width="595" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" height="354">
          <tr>
            <td width="12" valign="top" bgcolor="#FFFFE2">&nbsp;</td>
            <td width="579" rowspan="3" valign="top" bgcolor="#FFFFE2">
              <p align="center">&nbsp;</p>
              <p align="center">&nbsp;</p>
              <p align="center"><b><font face="Times New Roman" size="2">Congratulations, your
              information/question has been sent !</font></b></p>
<p align="center"><b><font color="#000000" size="2" face="Times New Roman">Thank you for
submitting&nbsp; your enquiries.</font></b></p>
<p align="center"><b><font color="#000000" size="2" face="Times New Roman">We will get back to you shortly...</font></b></p>
<p align="center">&nbsp;
</p>
<p align="center"><a href="file:///E:/Shadowpuppet/clients/Battbroadbent/html/index.html"><font face="Times New Roman" size="2">Back
to homepage</font></a>
</p>
</td>
          </tr>
          <tr>
            <td width="12" valign="top" bgcolor="#FFFFE2">&nbsp;</td>
          </tr>
          <tr>
            <td width="12" valign="top" bgcolor="#FFFFE2">&nbsp;</td>
          </tr>
        </table></td>
      <td height="304" width="71" valign="top" bgcolor="#FFFFE2"><br>
      </td>
    </tr>
    <tr background="../images/backgd.jpg">
      <td valign="bottom" width="581" height="21" bgcolor="#FFFFE2">
        <div align="center">&nbsp;
        </div>
        <div align="center">&nbsp;</div>
        <div align="center"><font face="Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">Copyright
          &copy; 2002 Batt Broadbent. All rights reserved. </font></div>
      </td>
      <%
SUB SendRegistration
      Dim Mailer
      Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
      Mailer.FromName   = "Enquiries"
      Mailer.FromAddress= "ennyyuliana@shadowpuppet.co.uk"
      Mailer.RemoteHost = "mail.shadowpuppet.co.uk"
      Mailer.AddRecipient "Enquiry", "ennyyuliana@shadowpuppet.co.uk"
      Mailer.Subject    = "Online Batt Broadbent Form"
      Mailer.BodyText   = "Dear Batt Broadbent Solicitors" & VbCrLf & VbCrLf & "You have received a Feedback" & VbCrLf & VbCrLf &_                                    
                                          "  Name          :"  & request.form("name") & VbCrLf &_
                                          "  Company      :"       & request.form("company") & VbCrLf &_
                                          "  Address            :"       & request.form("address1") & VbCrLf &_
                                          "                          :"       & request.form("address2") & VbCrLf &_
                                          "                          :"       & request.form("address3") & VbCrLf &_
                                          "  Postcode      :"       & request.form("postcode") & VbCrLf &_
                                          "  E-mail Address            :"       & request.form("email") & VbCrLf &_
                                          "  Department      :"       & request.form("dept") & VbCrLf &_
                                          "  Question      :"       & request.form("question") & VbCrLf & VbCrLf& VbCrLf &_

                                          "------------------------------------------------------" & VbCrLf &_                  
                                          
                                                                                    
                                          "THANK YOU "                                                                                                                                                                                                                                                                        
      if Mailer.SendMail then
        ThankYou
      else
        Response.Write "Mail send failure. Error was " & Mailer.Response
      end if
      Set Mailer = nothing
END Sub

SUB ThankYou
      response.write "&nbsp;&nbsp;&nbsp;<b><br><font color=#000000></b></font><br><br><br>"
END Sub

%>

      <td width="71" height="21" bgcolor="#FFFFE2">&nbsp;</td>
    </tr>
  </table>
</form>
</body>
</html>


ASKER CERTIFIED SOLUTION
rascalpants

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
rascalpants

the language in PHP is closer to Javascript of Flash Actionscript than to VBScript...

you have to put a ";" at then end of every bit of code when you are ending it like Javascript...


let me know if you need more help

rp
luvskyline

ASKER
I have uploaded the pages, and I got an error. On clicking submit on the enquiry.php page, I received an error: Parse error: parse error in /usr/local/etc/httpd/htdocs/battbroadbentcouk/php/termsnconditions.php on line 55 which appears to be:
foreach ($isElem ) {

The location of the page is: http://www.battbroadbent.co.uk/php/enquiry.php
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
rascalpants

I assumed you would be getting some errors...

I am not sure what you are doing with your ASP for each loop...  maybe if you write out some psuedo code, and I can see what I can do...


rp
luvskyline

ASKER
i was trying to make a enquiry form page with the first page called contactus.asp. then it will prompt the user to a terms and conditions page called termsnconditions.asp. when the user clicked on continue as an agreement to the terms n conditions, the user's enquiry will be sent to the company's mailbox. that's what the loops is trying to do for me in asp.
rascalpants

I don't think you need it do you?  can't you just use an if then statement without a foreach loop...

like:

if($TandC = "agree"){
do something...
} else {
don't do something...
}


I don't know why you need to complicate things...


try that out and let me know...


rp
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
luvskyline

ASKER
well, do u think we can use HTML to create those pages with ASP script i posted?
rascalpants

are you changing back to ASP?  if so, then why?

your form can be an html page, but the processing or confirmation page needs to be either php or asp...


let me know what is going on with this one...


rp
luvskyline

ASKER
dear rp,

i am actually helping my friend. i developed the ASP pages for me until she told me that her company's server is using linux. so she asked if i could help her with PHP. i have no idea at all about PHP. i have told her to try out the script u posted as my server doesn't support PHP. she is quite blur and hasn't given me the feedback. she did ask if the whole thing could be in HTML so i redo the form her her in HTML.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
rascalpants

you can't use only HTML to process the page...

you have to use some middleware like PHP, ASP, or CGI/Perl to talk to the web server...

you wanted me to change out what you had in ASP to PHP, and that is the best I could do for you, without knowing everything...


I think that should have been enough for the points...


rp