Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Please help me with sendmail! (https://www.warriorforum.com/programming/109293-please-help-me-sendmail.html)

Cruiser 31st July 2009 10:20 AM

Please help me with sendmail!
 
Hi all

I hope you can help me. I set up a simple form on my website, only fields for name and e-mail and a send button. I am using Joomla, and I added the folowing code in the source field of an article. (Should it be here or somewhere else?)

Quote:

<form action="sendmail.php" method="post" name="Form">
<p style="text-align: center">Name&nbsp;&nbsp;&nbsp; <input name="Name" type="text" /></p>
<p style="text-align: center">E-mail&nbsp;&nbsp; <input name="E-mail" type="text" /></p>
<p style="text-align: center"><input type="submit" name="Send" value="Send" /></p>
</form>
<?php
$Name = $_REQUEST['Name'] ;
$E-mail = $_REQUEST['E-mail'] ;
mail( "me@mysite.com", "Feedback Form Results",
$message, "From: $Name" );
header( "Location: http://www.redirecthere.com" );
?>


I made sure sendmail is selected in the global configuration, and the sendmail path is given as /usr/sbin/sendmail.

Now when I enter values and click send on my site I get the following message: "The page cannot be found". The URL of this page is http://www.mysite.com/sendmail.php. What is wrong? I know this is a simple form, but I want to test the sendmail function before I write a more complicated form script.

Thanks

Aronya 31st July 2009 02:51 PM

Re: Please help me with sendmail!
 
Does the sendmail.php file actually exist in the root folder of your site?
Any differences in capitalization between the file name & the reference to it in your code?
If you manually type in the address to the file in a browser, what do you get?

The sendmail.php file has to exist where your form is looking for it. In this case, since you aren't specifying the full URL (http:\\www...sendmail.php), the server is going to be looking for it in the same directory as the page your form is on. If it's in another location, either move it, or fix the location in the form: <form action="sendmail.php"...>

gesman 31st July 2009 07:42 PM

Re: Please help me with sendmail!
 
$E-mail - invalid variable name.
Make it $e_mail


Gleb

Cruiser 1st August 2009 03:45 AM

Re: Please help me with sendmail!
 
Okay I'll give it a try.

I just want to make sure (I am a day into coding...okay). I am using Joomla, and in the editor for articles there is a button to see the code, must I put both the HTML and PHP code there? In the global configuration Joomla gives the path of sendmail as I said above...should I change it somehow to the path of the article?

Thanks for your time!

Cruiser 1st August 2009 04:14 AM

Re: Please help me with sendmail!
 
It still don't work. I corrected the variables in the code. In the global configuration of Joomla the path of sendmail is given as /usr/sbin/sendmail (just like that - it is the default path - I didn't change anything).

What I noticed is, when I save the article and open it again, the name of the form is changed to [object] when you click on form properties in the editor. However it still remains form in the code. I changed the name of the form to [object] in the code, and it still doesn't work.

When I submit a name and e-mail I get a error that the page cannot be displayed. The URL of this page is www.mysite.com/sendmail.php!

Please help! I am so frustrated, I am struggeling for a week now!

Cruiser 1st August 2009 07:48 AM

Re: Please help me with sendmail!
 
Okay I think I know what is wrong. I saw that I must upload a file called sendmail.php somewhere via my ftp directory. Can someone please send me a link to such code and where I must put it?

Aronya 1st August 2009 11:39 AM

Re: Please help me with sendmail!
 
Quote:

Originally Posted by Cruiser (Post 1039718)
Okay I think I know what is wrong. I saw that I must upload a file called sendmail.php somewhere via my ftp directory. Can someone please send me a link to such code and where I must put it?

Okay. What part of my post did you not understand?

Cruiser 2nd August 2009 02:08 AM

Re: Please help me with sendmail!
 
Sorry...I am new to all this stuff! I think I did everything right now. When I click on send I get the following message:

Quote:

Warning: Cannot modify header information - headers already sent by (output started at /home/voxvoxis/public_html/sendmail.php:2) in /home/voxvoxis/public_html/sendmail.php on line 8

Cruiser 2nd August 2009 02:10 AM

Re: Please help me with sendmail!
 
Just another thing, when I build the form in Joomla, I name the form as "form". Then when I add the text boxes an the button, the form name automatically change to [object]. I have tried to rename it back to form but it doesn't accept this change. Why is this happening?

Cruiser 2nd August 2009 02:19 AM

Re: Please help me with sendmail!
 
It works!!!
Thanks everyone!!


All times are GMT -6. The time now is 03:18 PM.