How to convert asp to php?

How to Convert "sendmail.asp" form to PHP form !!?

  • <%@ Language="VBScript" %> <% strBody = "Name: " & Request.Form("r_Name")& chr(13) & chr(10) strBody = strBody & "Nationality: " & Request.Form("r_Nationality") & chr(13) & chr(10) strBody = strBody & "E-mail: " & Request.Form("re_Your_Email")& chr(13) & chr(10) strBody = strBody & "Tel: " & Request.Form("rd_Your_Tel")& chr(13) & chr(10) strBody = strBody & "Train Direction: " & chr(13) & chr(10) strBody = strBody & "From: " & Request.Form("r_Train_Direction")& chr(13)& chr(13) & chr(10) strBody = strBody & "To: " & Request.Form("r_direction_to") & chr(13) & chr(10) strBody = strBody & "and " & chr(13) & chr(10) strBody = strBody & "From: " & Request.Form("second_dir_from") & chr(13) & chr(10) strBody = strBody & "To: " & Request.Form("second_dir_to") & chr(13) & chr(10) strBody = strBody & "From: " & Request.Form("r_Date_of_Travel_From") & chr(13)& chr(13) & chr(10) strBody = strBody & "To: " & Request.Form("r_Date_of_Travel_to") & chr(13)& chr(13) & chr(10) strBody = strBody & "Train Type: " & Request.Form("r_Train_Type") & chr(13) & chr(10) if (Request.Form("r_Train_Type") = "Sleeper Train") then strBody = strBody & "No. Of Cabin: " & chr(13) & chr(10) strBody = strBody & "Double: " & Request.Form("r_Number_of_Cabin_Double") & " , Single: " & Request.Form("r_Number_of_Cabin__Single"… & chr(13) & chr(10) else strBody = strBody & "No. Of Tickets: " & Request.Form("r_Number_Of_Tickets") & chr(13) & chr(10) end if strBody = strBody & "Arrival date: " & Request.Form("Time_of_Travel") & chr(13) & chr(10) strBody = strBody & "No of Adults: " & Request.Form("r_Number_of_Adults")& chr(13) & chr(10) strBody = strBody & "No of Children: " & Request.Form("Number_of_Children")& chr(13) & chr(10) strBody = strBody & "No of Infants: " & Request.Form("r_Number_of_Infants")& chr(13) & chr(10) strBody = strBody & "Comments: " & Request.Form("w_Comments")& chr(13)& chr(13)& chr(13) & chr(10) Set Mail = Server.CreateObject("Persits.MailSender"… Mail.Host = "mail.paradisetravelegypt.com" Mail.From = Request.Form("re_Your_Email") Mail.FromName = Request.Form("r_Name") Mail.AddAddress "[email protected]" 'Mail.AddReplyTo "[email protected]" Mail.Subject = "Train Reservation Request" Mail.Body = strBody On Error Resume Next Mail.Send If Err <> 0 Then Response.Write("Error encountered: " & Err.Description) End If Response.Redirect("http://www.parad… %>

  • Answer:

    Change the variable names to have a $ in front (like $strBody) Change string concatenation to a dot (& to .) Change chr(13) & chr(10) to "\r\n" Look at the syntax of mail() (http://us.php.net/manual/en/function.mail.php ) - there are lots of examples in the posts at the bottom. (The error trapping is a little different. mail() is boolean, so you can say if mail(<insert some variables here>) { //do what you do if the mail is sent } else { //do what you do if there's an error }

Amr Fathey at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.