Jump to content


Photo

Php email form help!


  • Please log in to reply
10 replies to this topic

#1 Caf26

Caf26

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 17 April 2013 - 09:37 AM

I am new to php and want to add a form to my site to send am email to the owner on completion of the form, I have got the code but when I try to run it in chrome (through notepad++) I click submit but it show the php code rather than sending an email, is this a problem with the code or because it's not on a server and just tan through notepads run in chrome function

#2 Jessica

Jessica

    This is not my name.

  • Gurus
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

Posted 17 April 2013 - 09:59 AM

Moved to the correct forum.

You need to be running a web server.
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.

How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq

Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!

#3 Minato

Minato

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 18 April 2013 - 10:35 AM

Moved to the correct forum.

You need to be running a web server.

To expand on this a bit more.  You need a server setup (There are products out there (free, of course)) that you can use to go as a localhost.  My personal favorite is WAMPserver.  It comes with the APACHE, PHP, and MySQL with phpMyAdmin.  Once you get it all setup, then you can test your PHP E-mail script.



#4 jazzman1

jazzman1

    Advanced Member

  • Gurus
  • 2,242 posts
  • LocationMississauga, Canada

Posted 18 April 2013 - 11:40 AM

You need to be running a web server.

 

Just to be clear:

 

1. He doesn't have a web server running php scripts, he needs to have only a server for example a linux one.

 

2. The web server doesn't care about emails only mail server cares of that.



#5 Jessica

Jessica

    This is not my name.

  • Gurus
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

Posted 18 April 2013 - 12:33 PM

Uhm, go reread this question.
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.

How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq

Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!

#6 jazzman1

jazzman1

    Advanced Member

  • Gurus
  • 2,242 posts
  • LocationMississauga, Canada

Posted 18 April 2013 - 12:56 PM

Jessi, I understand what you want to say to him, but sometimes the users especially windows one, they messed up php, http, mysql, smtp, etc.....

 

What wrong I said here:

 

He doesn't have to have a web server to execute php scripts and to send emails it has requered an mail server.



#7 Jessica

Jessica

    This is not my name.

  • Gurus
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

Posted 18 April 2013 - 01:16 PM

He does if he wants to run the scripts in the browser. Yes, you can run PHP in the command line. DO you really think that's what he wants to do?

The problem is that he doesn't even have a web server running. From THERE he can worry about the email server.

Edit: By web server I am talking about the software, not the hardware. He needs Apache or similar. I use Apache on my windows machines. It has nothing to do with the Operating System or the hardware.

Edited by Jessica, 18 April 2013 - 01:18 PM.

My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.

How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq

Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!

#8 jazzman1

jazzman1

    Advanced Member

  • Gurus
  • 2,242 posts
  • LocationMississauga, Canada

Posted 19 April 2013 - 02:14 PM

DO you really think that's what he wants to do?

 

 

Who knows.....maybe one day  :tease-01: 



#9 buzzycoder

buzzycoder

    Member

  • Members
  • PipPip
  • 29 posts
  • Locationlocalhost
  • Age:21

Posted 08 May 2013 - 10:20 AM

As of I think he wants to send mails from his PC & he got the code too,but when he run it in the browser he got php code rather than output.As you guys said,he need web server & mail setup too.

 

Caf26 : You can try Xampp & setup mercury mail in it.So,you can easily send mails from your pc or local server.

Hope it helps you & other newbies! ::)


I am available for custom developments & issues!You can contact me on buzzycoder[@]gmail.com :happy-04:!


#10 Caf26

Caf26

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 11 June 2013 - 03:56 AM

Hi i am pretty new to html and php coding, i am creating a website and have a contact form on one of my pages i have gathered the code and got the form working when hosted with 000webhost (free hosting) i have now purchased hosting from go daddy and uploaded my site there, my contact form now shows code in each field although its the same file as i uploaded to the free hosting site. can anybody suggest why it is doing this with go daddy, i have the deluxe hosting package. thanks!



#11 mac_gyver

mac_gyver

    Advanced Member

  • Moderators
  • 1,872 posts

Posted 11 June 2013 - 07:26 AM

posting your code would be the quickest way of helping you find what it is doing that might be server specific.

 

best guess is you got caught using php's short open tags <?


multi-purpose programming fool and resident naysayer [We try not be negative in replies, but telling someone what they're doing wrong, while staying politically correct, isn't always going to happen.]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com