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.
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...
<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> </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"> what you need to do<br>
    <img src="bullet.gif"> what we can offer<br>
    <img src="bullet.gif"> 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"> </td>
       <td width="342">
        <input type="text" name="address2" size="40">
       </td>
      </tr>
      <tr>
       <td width="135"> </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"> </p>
    <p> </p>
    </td>
  </tr>
  <tr>
   <td width="200" valign="top" height="3">
    <p><font face="Times New Roman, Times, serif" size="-1"><br>
     </font></p>
    </td>
   <td height="3"> </td>
  </tr>
 </table>
</div>
</body>
</html>
</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>
   </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
        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. Do you wish to continue?</font></p>
      Â
     <p align="right">
      <font size="2">
      <input type="submit" value="Continue" name="submit"> <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> </p>
      Â
       <p align="center"> </p>
       <p> </p>
   Â
    <p align="left"> </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
                 %>
                                       "------------------------------------------------------" & 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 " <b><br><font color=#000000></b></font><br><br><br>"
END Sub
%>
   <td width="71" height="21" bgcolor="#FFFFE2"> </td>
  </tr>
 </table>
</form>
</body>
</html>
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 ) {
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...
}
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.
http://asp2php.naken.cc/download.php
I havent used this software but it will do your job
Harry