This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

PHP Send Form to Email  RSS feed

 
Anthony Palazzo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all. I am fairly new to PHP and I'm running into a few problems and I don't really know where to start. I have a form that is trying to submit and send to an email address. I am using jQuery ajax function along with php mail function. I installed a WAMP server on my PC (not sure if that's where I'm running into an issue). I typically get "syntaxerror: json.parse: unexpected character" error message. Also, if this is not the proper forum to post in, I apologize in advance and please point in the right direction. Thanks! Here's the JavaScript and PHP code:

JavaScript:


PHP:
 
Nick Charles
Ranch Hand
Posts: 71
Linux PHP Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect that json_encode doesn't like the HTML string contents. Try removing json_encode and just echo the msg. Or remove the HTML tags from the message text.

 
Anthony Palazzo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nick Charles wrote:I suspect that json_encode doesn't like the HTML string contents. Try removing json_encode and just echo the msg. Or remove the HTML tags from the message text.


Hm. Neither seems to be working unfortunately.
 
Nick Charles
Ranch Hand
Posts: 71
Linux PHP Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you removed the calls to json_encode you should be getting a different error message. What error are you getting now?

Also, it might help to post the entire error message, or web page with the error message. The full text might provide some insight.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!