PHP code the code works but aspx does not work...

First of all - many apologies because it is NOT directly associated if I use Dw CS6 and Visual Studio 2012 set of Dreamweaver.

I have two pages of contact - want it in aspx rather than php because I get vb code while I do not understand php.

In addition to this, I add validation in the aspx version that I do not know how to do it in a php page.

Then...

The php version works with the mail command.

It DOES NOT REQUIRE to have a specified smtp mail server AND IT WORKS.

However try the same in VB/ASP.NET is a different baby.

Thanks in advance for any comments.

Terry

the php file is: -.

------------------------------------------------------------------------------------------ -----------

< body >

<? PHP

$recipient = ' [email protected] ';

$subject = "EXAMPLE PHP CONTACT."

Success message sent to the user after the e-mail was sent. / / You can leave it as what or change the wording.

$success = "< h1 > thank you to fill out and submit the form. < / h1 > < p > someone will process your message and get back to you as soon as posible. "< /p > < p > < a href =" / "> < /a > back to Home Page < /p >";

error message sent to the user. / / You can leave it as what or change the wording.

$failure = "< h1 > there was an error by e-mail information < / h1 > < p > we could not send your information to return of form at the moment." < /p > < p > please wait a few minutes and try again. "< /p > < p > < a href =" / "> < /a > back to Home Page < /p >";

###########################################

Do not edit below this line

###########################################

Collect all the information on the form and check that all fields have been filled.

$email = $_POST ['email'];

If (sizeof($_POST)) {}

$message = "";

While (list ($key, $val) = {each($_POST)})

If ($key == 'Submit') {}

do nothing

}

else {}

$message. = "$key: $val\r\n";

Checks if the $val contains data

{if (Empty ($Val))}

ECHO ("< h1 > error in the entry of the form < / h1 > < p > all the form fields must be filled in and some have not been filled in. < /p >")

< p > please visit < a href = "javascript: history.go(-1)" ' > back < /a > and try again < /p > ");"

Exit();

//}

}

}}

Validate email address

If(!preg_match("/^[a-z0-9]+([_\\.-][a-z0-9]+) * '. ' @". " ([a-z0-9]+([\.-][a-z0-9]+)*) + ". » \\. [a - z] {2,}"." $/ "(,$email)) {}"

ECHO ("< h1 > error in form input < / h1 > < p > a wrong e-mail address was entered.") < /p > < p > please go < a href = "javascript: history.go(-1)" ' > < < /a > /a > back, and then try again > /p > ");"

Exit();

}

###########

function filter_email_header ($form_field) {}

Return preg_replace ('/ [\0\n\r\|\!\/\<\>------^-$-%------*--------&] + / ', ", $form_field);

}

$email = filter_email_header ($email);

$headers = "from: $email\n";

$sent = mail ($recipient $subject, $message, $headers);

If ($sent)

{

the below html code can be modified to change the user receives the message of thanks

? >

Success of < h1 > < / h1 >

< /P > < p > SUCCESS

<? PHP

} else {}

the message that is sent to the user if the form information has not been sent.

? >

< h1 > something went wrong < / h1 >

< p > SOMETHING going ON WRONK < /p >

<? PHP

}

? >

< / body >

---------------------------------------------------------------------------------

The aspx file is: -.

---------------------------------------------------------------------------------

Imports System.Net

Imports System.Net.Mail

Partial Class _Default

Inherits System.Web.UI.Page

Protected Sub btnSubmit_Click (ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

Me.lblError.Text =""

Me.divResultDiv.InnerHtml = "XXXX".

lblName.Text = «»

lblEmail.Text = «»

' -------------------  validation  ---------------------

If Trim (Me.txtName.Text) = "" then

lblName.Text = "this field is required.

Exit Sub

End If

If Trim (Me.txtEmail.Text) = "" then

lblEmail.Text = 'this field is required.

Exit Sub

End If

If Trim (Me.txtEmail2.Text) = "" then

lblEmail2.Text = 'this field is required.

Exit Sub

End If

If (txtEmail.Text) Trim <>Trim (txtEmail2.Text) then

lblEmail2.Text = "e-mail addresses must match to.

Exit Sub

End If

If Ucase (Trim (txtAnswer.Text)) then <>'WHITE'

lblError.Text = 'Did not question correctly.'

Exit Sub

End If

' -------------------  validation  ---------------------

' --------------------------------------------------------

"IF WE GET HERE then EVERYTHING OK - BUILD THE MESSAGE

' --------------------------------------------------------

Dim mail as new System.Net.Mail.MailMessage

mail. Body = Me.txtComment.Text

mail. Subject = "MESSAGE FROM WEB.

mail. To.Add ("[email protected]")

mail. From = new System.Net.Mail.MailAddress (Me.txtEmail.Text)

Dim smtp as new System.Net.Mail.SmtpClient

Dim strMessage As String = «»

Try

SMTP. Send (mail)

"Me.lblStatus.Text ="Message sent... We will answer you as soon as possible"

strMessage = "< h2 > < / h2 > < h2 > thank you for your inquiry." "< / h2 >" & _

"< br / > < /p > to SUCCESS."

Catch ex As Exception

"Me.lblStatus.Text ="There is an error in sending, please try again in a moment"

strMessage = "< h2 > < / h2 > < h2 > error sending message < / h2 >" & _

"< br / > < FAILURE P > < /p >.

End Try

Me.Panel1.Visible = False

Me.divResultDiv.InnerHtml = strMessage

End Sub

End Class

You use System.Net.Mail , which in turn uses SMTP rather than the PHP mail() function.

To see more

or Google the topic.

Tags: Dreamweaver

Similar Questions

  • Dreamweaver CS6 how can I automatically indent the code? I've already put the presets and the codeview options, but it does not work.

    Dreamweaver CS6 how can I automatically indent the code? I've already put the presets and the codeview options, but it does not work. Thanks for advice

    Commands > apply Source format.

    I use it so often, I created a shortcut to it.

    Nancy O.

  • 6 Lightroom unbootable after an update... I reinstalled the software, but it still won't start? Updated through the creative cloud but still does not start?  What should do?

    6 Lightroom unbootable after an update... I reinstalled the software, but it still won't start? Updated through the creative cloud but still does not start?  What should do?

    My computer is a PC with Windows 10.
    Everything worked well before the Update Adobe Lightroom 6.
    The software was purchased in a shop (FNAC) with software to download map, it is saved in my account (Adobe) with its serial number. Why is this so difficult thing to reinstall Adobe software?


    I apologize for the inconvenience.

    Since it appears and disappears from the Task Manager, it seems that Lightroom crashes.

    We have seen this kind of problem on Windows 10 when Visual C++ Reditsributable 2012 update 4 is not installed correctly, it is necessary to run certain programs. You might have encountered until now Adobe programs that require it.

    Otherwise, there could be another cause of this accident and if C++ installation does not help, then you need to share the event viewer crash logs. See this article for in crash logs: Photoshop Elements Editor Help. How to find the crash logs on to Windows

  • Addition of Google Chrome, now Safari does not open, impossible to link electronic mail links.  Just received message "Safari is closed."  Tried deleting 3rd party add ons. Is went into preferences, Safari is the default browser, but it does not open.

    Add Google Chrome, now Safari opens Cannot link e-mail links.  Just received message "Safari is closed."  Tried deleting 3rd party add ons. Is went into preferences, Safari is the default browser, but it does not open.

    Third party extension and plug-ins?

    If Safari is slow, unresponsive, which closes unexpectedly, or has other issues

    The problem may be caused by a Safari Extension, Internet plug-in or another add-on.

    The safari Extensions, Internet plug-ins, and other modules are designed to improve or customize the browsing experience. Modules are widely available on the Internet, and some are installed as part of an application or other software. If you have Add-ons installed, an add-on might be at the root of the issue.

    If the problem is the unwanted pop-up windows, advertisements and graphics while surfing on the web, discover how to remove the ad-injection (adware) from your Mac software.

    Disable the Safari Extensions

    You can disable Extensions Safari to learn if all are causing the problem.

    1. In the Safari menu, choose Preferences.
    2. Click the Extensions icon, and then select an extension from the list.
    3. Uncheck the box enable disable this extension.

    If turning off an extension solves the problem, look for updates of the extension by clicking Update in the lower left corner of the window. Or remove the extension by clicking on the button uninstall.

    Remove Internet plug-ins and other add-ons.

    You can remove Internet plug-ins and other add-ons to see if everything is the origin of the problem. To find them, quit Safari and open these folders in library:

    • The library folder at the top level of your hard drive. Open it from the Finder by choosing go > go to folder in the menu bar. Then type /Library and then click OK.
    • The record library in your home folder. Open it by organizing the Option while choosing go > library in the menu bar.

    The folders in the library contains the following folders for modules. Move all the files in these folders to the trash.

    • Internet Plug-Ins
      Do not remove the default Browser.plugin, nslQTScriptablePlugin.xpt, Composer.webplugin of Quartz or QuickTime Plugin.plugin.
    • Input methods
    • InputManagers
    • ScriptingAdditions

    If the removal of the files in these folders solves the problem, quit Safari again and gradually put the files until you find the one at the origin of the problem:

    1. Open the Recycle Bin and select one of the files that you removed. Chose file > back up. The file back to its folder.
    2. Open Safari and see if the problem returns.
      • If the issue is returned, you have identified the add-on causing the problem. Do not use or contact its manufacturer for an updated version.
      • If the question does not return, quit Safari and put back another file.
  • I have a HP Pavilion a1700n it shows the necessary updates, but its does not download

    I have a HP Pavilion a1700n it shows the necessary updates, but its does not download

    There is a program that addresses this issue.  It's called the system update tool.   Please select the correct version.

    The original specifications of this computer is Vista 32 bit.

  • Tips on how to get attached with Nikon D810 and Lightroom - I tried with the uSB cable but Lightroom does not recognize the camera. My memory card has no images on it that I read somewhere that it can slow things down if it has pictures on i

    I tried to use the uSB cable, but Lightroom does not recognize the camera. My memory card has no images on it that I read somewhere that it can slow things down if she has no images on it

    If you use Lightroom CC / 6 on a Mac OSX El Capitan you must update to the latest version of CC 2015.4 / 6.4. Problems with Nikon capture home has been fixed in the latest update, the lis below.

    Lightroom Journal | Tips and advice straight from the Lightroom team.

  • I wish I had a client on my PC to communicate with the Lync server, but it does not work.

    Evaluation of the VHD Lync 2010 program

    I'm quite new to Lync and I'm trying to understand how it all works. I downloaded the virtual computer files and got successfully throughout the environment, but now, I would like to have a client on my PC to communicate with the Lync server but I'm not having any luck.

    Here are the servers that I have:
    DC
    Exum
    Lync-Qms
    Lync-Se
    SPS2010
    These are all in an internal network and I gave the Lync-SE server outside access, assuming that it's the server that my client needs to communicate with because he runs the Lync server. Initially, I was getting a certificate error. I exported the certificate of the server DC, installed on my client and the client toward the DC server who gave me the certificate number, but now I get an error that the server is temporarily unavailable. I'm far from base here?

    Hello

    Thank you for visiting the Microsoft answers community site. Your question is better suited for the IT Pro TechNet public. Please post your question in the TechNet Windows 7 Server forum.

    I hope this helps.

  • I colored the spry menu, but it does not appear in the preview.

    I changed the color of my spry menu of beige to black. It appears on my work page, but when I try to preview, it's as if I had never changed color. I also tried to go to the page via Firefox, but it does not appear there either. The code says the bottom of the menu is #000, we design signs it indicates the background color is #000 institutions. Can someone tell me what I'm missing that deploys the spry menu stay in the default color?

    Not a good option, unfortunately.

    "allow multiple consecutive spaces" is an old option in DW who must be stopped. He inserts just several nonbreaking spaces when you press the SPACEBAR.

    It's ugly and unpredictable because it depends on the font size, sizing of browser text etc.

    Better to use CSS

    tracking http://www.w3schools.com/cssref/pr_text_letter-spacing.asp

    Wee http://www.w3schools.com/cssref/pr_text_word-spacing.asp

  • HotSync downloaded 6.2, vista OS, bluetooth in the new computer, but hotsync does not list bluetooth as a connection option

    I downloaded the new 6.2 hotsync (which is listed as 7.0.2 in the lower left corner of hotsync), I have a new toshiba laptop with vista 64-bit os, laptop has bluetooth and the bluetooth works because I already set up to work with my treo 755 as a modem. In any case, when I'm trying to set up the connection to hotsync option so I can sync my outlook with the treo, connections in hotsync does not list bluetooth as an option.  I read that it will only show if the material has bluetooth.  Again, I have no bluetooth and it works very well with the treo when I put up as a modem for a wireless connection.  Any thoughts why hotsync is absent from the bluetooth connection option?  It is defined as discovereable as well.

    Thank you!

    At this point, the only thing left that I could suggest is to buy a bluetooth USB dongle and see if it will work. When you install the dongle, do not use the cd to install the drivers, let Windows install the drivers. It sounds like this is similar to what we were looking for with the Toshiba Bluetooth radio but the dongle uses a different radio and they worked for Bluetooth hotsync on other 64 bit Vista systems.

    Dongles/adapters listed as compatible are the following;

    • Belkin Bluetooth USB adapt BT
    • Motorola adapter USB Bluetooth (Verizon only)

    I sent you a private message to this topic.

    Message relates to: Palm i705

  • I have an older version of InDesign with the serial number, but it does not appear valid when I enter the code

    My serial number does not work.  Why?

    You say you will return CS. You mean you just pay for it? You realize that it is 12 years old, is not compatible with any modern system, and cannot be enabled at all? If it was more than 1 cent, you have been stolen!

  • App Builder install-tried all the recommended fixes, but still does not work

    Hi all

    I've read similar questions others have had to install the generator of the app and tried the fixes suggested, but am still installation issues.

    I downloaded the latest version of the App Builder (32.4 I think), and am in Mac OS X 10.7.5. When I try to install I get the error "Sorry, year error has occurred." The application could not be installed because the Installer file is damaged. Try obtaining a new installation of the author of the application program.

    Just out of curiosity, I tried to install the same file on another Mac (OS X running 10.10.2) and installed without problem. If the installation file seems fine.

    Depending on the system configuration required, my 10.7.5 system must supports installation, so I don't know what else to try.

    Thanks, Louise.

    Ok. For assistance with this then, call the business support. You can find contact information by logging on http://digitalpublishing.acrobat.com/ and looking in the Middle at the bottom of the screen.

    Neil

  • Problems connecting to a projector. Laptop recognizes the new monitor but projector does not display anything.

    I have a Macbook Pro (non-retina display) mid-2012. I have a mini VGA screen that worked throughout the year and all of a sudden, it doesn't seem to work. My computer recognizes the new monitor (screen flickers and flies all content secondary screen) but the projector does not display anything. I tried to reconnect the cable, the cable VGA switch to turn on the projector and turn off, restart my computer and clouds of dust on the connections. Sometimes if I move the connection just that will work, but if I so much as breathe on it or watch funny it stops and I can't get it back.

    Jiggle the cable or adapter is something different, you have a physical adapter or cable problem. Any bit-reversal can help that.

  • Windows detects the USB key, but it does not appear in 'my computer '.

    When I insert the USB, windows doesn't detect the same, but the icon does not appear in 'My Computer', or anywhere else and I can't use the USB.

    The best diagnostic page on the web that I found for USB Pen Drive problems such as what you have is the following:

    <>http://www.Uwe-Sieber.de/usbtrouble_e.html >

    HTH,
    JW

  • The package paid but Adobe does not

    Recently, I have renewed my package from adobe that gave me access to most of the adobe programs. But now when I click on any of them my creative cloud comes app saying "Please wait a moment" his tent see if I paid. It does not load after almost a week.

    log out and then back to your client application using the adobe id to pay for your subscription in cc: http://helpx.adobe.com/creative-cloud/kb/sign-in-out-creative-cloud-desktop-app.html

  • I have placer place text, and then change the font size, but it does not flow to the next page

    Hello! Tell when I have text that fits into a page, because it is absorbed in indesign with a great font size small. Then when I want to increase the font size it does not continue on the next page. How can I get there?

    Thank you very much!!

    Click the port at the bottom right of the text block to recharge the cursor, go to the next page and click to place it.

    If this is new to see you:

    Text of wire among images in Adobe InDesign

    InDesign 03 - Mini tutorials - threads of text - Threads view - overflow of text warnings areas - YouTube

Maybe you are looking for