Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > RocketCake
PHP Form

bill2003
Registered User
Quote
2023-04-28 14:57:54

I have a problem where as soon as I add an email address to the php code within a form, the page will only show as a white screen and nothing else. If I remove the email address and republish the site, the form appears but of course, the form won’t email.
I have tried different emails including my own but I cannot get the form to work.
I have checked the server and tried changing the php version but nothing changes.
I did have it working on an earlier site when using version 4.8 of RocketCake.
Any help would really be appreciated.
Bill


erik
Registered User
Quote
2023-04-28 15:01:25

That sounds like you have some syntax error in your code, and PHP error message output is disabled on your server, causing the page to become white instead.

Maybe post the code you are using here, or enable error message output in your webserver's setting and see what error your get.


bill2003
Registered User
Quote
2023-04-28 17:18:05

Hello Erik,
Thanks for your feedback and this is the code I am using:

$text = “”;

foreach($_POST as $name => $value)

{

$text .= “$name : $value\n”;

}


if ($text != “”)

{

echo ‘ <span style=“font-size:14pt; font-family:Arial, Helvetica, sans-serif; font-weight:normal; color:0000FF; line-height: 1.5; “>Thanks for contacting us</span>’;

mail(“bill@icloud.com”, “Contact form request”, $text);

}

I've changed the email address slightly but nothing more.

I've also tried this code which is from this Forum and get exactly the same results:

$text = “”;

foreach($_POST as $name => $value)

{

$text .= “$name : $value\n”;

}


if ($text != “”)

{

echo ‘ <span style=“font-size:14pt; font-family:Arial, Helvetica, sans-serif; font-weight:normal; color:0000FF; line-height: 1.5; “>Thanks for contacting us</span>’;

mail(“youremail@example.com”, “Contact form request”, $text);

}

Any help will be appreciated.
Bill


its-gazz
Registered User
Quote
2023-05-07 15:26:53

I'm using a modified version of the above code to include a captcha https://itservices.ie/contact.ph...


erik
Registered User
Quote
2023-05-08 10:11:39

@bill2003: I guess you are using macos? It has replaced some of the quote characters in your code. For example
echo ‘ < ...


That should be

echo ' < ...


I think macOS replaced most quotes automatically with an invalid character - you cannot use “ and ” but need to use " and " instead. I think it's called "magic quotes" and can be disabled in the system settings.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internation?l" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact