PHP and HTML inside ASP.NET

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Nov 2008
Posts: 42
Reputation: squarkman is an unknown quantity at this point 
Solved Threads: 0
squarkman squarkman is offline Offline
Light Poster

PHP and HTML inside ASP.NET

 
0
  #1
Dec 5th, 2008
I have a template for web pages which is asp.net
Inside the content object or whatever it's called, it wish to place a simpe PHP form. I tried it and the PHP code doesn't seem to be recognized as PHP but as text.
Can this NOT be done?

  1. <%@ page language="VB" masterpagefile="~/pages/airedale911.master" autoeventwireup="false" inherits="feedback, App_Web_i5ksdbwd" title="airedale911.org: Feedback" %>
  2. <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
  3.  
  4. <?php
  5.  
  6. if(isset($_POST["Submit"]))
  7. {
  8. require("c:\php\includes\class.phpmailer.php");
  9.  
  10. $mail = new PHPMailer();
  11.  
  12. ////////////////////////////////////////////////////////////////
  13. // Customize the following 5 lines with your own information. //
  14. ////////////////////////////////////////////////////////////////
  15.  
  16. $toaddress = "rocky@airedale911.org"; //Change this to the email address you will be receiving your notices.
  17. $mailhost = "mail.airedale911.org"; //Change this to your actual Domain name.
  18. $fromaddress = "rocky@airedale911.org"; //Change this to the email address you will use to send and authenticate with.
  19. $frompwd = "password"; //Change this to the above email addresses password.
  20. $subject = "Airedale 911 Application Form"; //Change this to your own email message subject.
  21.  
  22. //////////////////////////////////////////
  23. // DO NOT CHANGE ANYTHING PAST THIS LINE//
  24. //////////////////////////////////////////
  25.  
  26. $fromname = $_POST["TName"];
  27. $body = $_POST["TBody"] ;
  28. $rplyto = $_POST["TEmail"];
  29. $msgbody = $fromname . "<br>" . $rplyto . "<br>" . $body;
  30.  
  31. $mail->IsSMTP();
  32. $mail->Host = $mailhost;
  33. $mail->SMTPAuth = true;
  34. $mail->Username = $fromaddress;
  35. $mail->Password = $frompwd;
  36.  
  37. $mail->From = $fromaddress;
  38. $mail->FromName = $fromname;
  39. $mail->AddReplyTo($rplyto);
  40. $mail->AddAddress($toaddress);
  41. $mail->IsHTML(true);
  42. $mail->Subject = $subject;
  43. $mail->Body = $msgbody;
  44.  
  45. if(!$mail->Send())
  46. {
  47. echo "Message could not be sent. <p>";
  48. echo "Mailer Error: " . $mail->ErrorInfo;
  49. exit;
  50. }
  51.  
  52. echo "Thank you, your message has been sent!";
  53. }
  54.  
  55. ?>
  56.  
  57. <html><body>
  58. <form name="SendEmail01" method="post">
  59. <table border=0>
  60. <tr>
  61. <td>Name:</td>
  62. <td><input type="text" name="TName" size="30"></td>
  63. </tr>
  64. <tr>
  65. <td>Email:</td>
  66. <td><input type="text" name="TEmail" size="30"></td>
  67. </tr>
  68. <tr>
  69. <td>Body:</td>
  70. <td><textarea rows="4" name="TBody" cols="30"></textarea></td>
  71. </tr>
  72. <tr>
  73. <td><input type="submit" name="Submit" value="Submit"></td>
  74. </tr>
  75. </form>
  76. </body></html>
  77.  
  78.  
  79.  
  80.  
  81.  
  82. </asp:Content>
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 123
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: PHP and HTML inside ASP.NET

 
0
  #2
Dec 5th, 2008
instead of doing that(which seem definitely impossible to me) insert an iframe in the content place holder and set the source to the php file.
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 42
Reputation: squarkman is an unknown quantity at this point 
Solved Threads: 0
squarkman squarkman is offline Offline
Light Poster

Re: PHP and HTML inside ASP.NET

 
0
  #3
Dec 5th, 2008
That's a great idea if it works.
Is it a complicated process or just a statement?
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 42
Reputation: squarkman is an unknown quantity at this point 
Solved Threads: 0
squarkman squarkman is offline Offline
Light Poster

Re: PHP and HTML inside ASP.NET

 
0
  #4
Dec 5th, 2008
Thanks Serkansendur
That works like a charm.
One way around aspx!
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 123
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: PHP and HTML inside ASP.NET

 
1
  #5
Dec 6th, 2008
Originally Posted by squarkman View Post
Thanks Serkansendur
That works like a charm.
One way around aspx!
Share this feeling by adding to me reputation then
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 42
Reputation: squarkman is an unknown quantity at this point 
Solved Threads: 0
squarkman squarkman is offline Offline
Light Poster

Re: PHP and HTML inside ASP.NET

 
0
  #6
Dec 6th, 2008
One last question since I added to your reputation, please.
You know how I added the Iframe to point to the php like you suggested. The php is a simple php form.
There is a SQL database also. It it technically possible to add lines to code beneath each form field stating that upon successful submission, add these variable values to the database?
We have a tracker that tracks submissions. Since I'm doing this differently from aspx I will have to find a way to get the NAME towhomemailed DATE etc into the tracker so there is a database listing of each submission.
Can this be done sort of after the fact in my php script?
Thx
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 123
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: PHP and HTML inside ASP.NET

 
0
  #7
Dec 6th, 2008
yes you can do that, you are going to use ajax in this case. when you click submit button, it will call javascript function to post aspx page. this is not an intriguing issue but you have to have a solid understanding of ajax. But i think the better thing to do is to synronize your sql server with mysql regarding that tracking tables. that way your application will be secure and more robust.
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum


Views: 832 | Replies: 6
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC