I am curious as to why I am getting an 404 error with my contact page.
I am using .php and html. here are two screenshots. I am needing help with this. Am I missing something?
If you need me to clarify anything let me know.
105 Replies
A program takes your PHP source code and transforms it to HTML that's sent to the client.
Your error is that the webserver can't find that the program that does that transformation.
Where are you serving from?
actually, the title has nothing to do with the error
the error just means that intelephense cant find the php executable in your pc
if you are on windows, download php and throw the folder in
c:\php\<version>
then edit the configurations to point to the php.exe file
the 404 error needs context and is unanswerable until we know how and what you are doing
and the html as wellI’m using bluehost and I’m using a Mac.
Sorry for the late response.
what Epic said is accurate btw, you have shown nothing that would make it possible to diagnose a 404 error
What do you need to see to know the error.
When are you getting the 404 exactly? When you go to the contact page, or when you submit the form?
When I submit the form
then we'll need to see the HTML of the form, specifically the form tag
preferably in a code block, not a screenshot
Okay, I will get that. Give me a minute.
Not sure how to do the code block
there's instructions in #how-to-ask-good-questions, but very quickly
```html
your code here
```
Those are backticks, the character left of 1 on a qwerty keyboard
Ok
what's the URL of the contact page?
just the part after .com/ or whichever
www.1kmdesigns.com
did you upload the process_form.php file?
yes I have, but I am not sure why its not finding the php file.
can you show a directory listing of your web root?
sure just a second
Here are two screen shots of the root on the server is this what your talking about?
The other screen shot is where I uploaded the php. I was told to upload it here by bluehost.
the second one is a screenshot of a piece of database management software, that's not where PHP goes.
Okay, then the lady did not know what I was asking then.
put the php file in the same folder as index.html, see if that works.
Okay
Yes it worked, I dont think the person I talked to knew exactly what she was doing.
Also after the viewer submits the file, I would like the user to be redirected back to the website. how do I do that?
OKay... Ill put that in, just a second
Sorry but its not redirecting
You have to move the echo. If that doesn't work, share your code
Okay
I put the echo back so you can see how it was before.
Here is the code
sorry, that was a typo, it was supposed to read "remove". Where did you put the header() call?
I put the header at the top
I am checking into why I did not receive the test emails.
oh, missed it there
you need to put that in the part of the script where the redirect needs to happen, so replace the echo with that redirect. Also, there's no need to put the entire URL there, and if you do, you don't need the space-slash
like that
you're also not using mail right, check the docs
OKay, let me make the changes
would this be correct?
I also deleted the echo, but it keeps showing after submission
it's not correct no. the mail function has this signature:
It means that, in order, it will take a string that represents the TO, a string that represents the SUBJECT, a string that represents the body of the message, then an array with additional headers.
Your original version would send an email to
[email protected]
using the subject Contact Form Submission from Person Name
, with the first name in the body, then the lastname as an additional header. If it didn't error out, which it probably would given that it's getting too many parameters
You probably want something like
also, did you re-upload the file after making changes?Yes I did, but for some reason its not making the changes. Let me check again and see whats going on.
did you save the file before re-uploading?
(I suggest these "is it plugged in" type solutions because they have both lost me hours of time in the past btw)
I will try it, I will continue later as I have a meeting this morning. I will message you later
Okay, I am receiving emails, but within the emails, I am not getting the messages.
Share your code
Okay
I went back to this php. I do get emails from this, but no the message within. The re-routing is not working. I get the 404 error when I use the new code that that you show me or follow by a link you posted.
I write the new code and it did not work. So I reverted back to this one.
I am now sending the html code
so is the email empty, or are you not getting the message part of the form?
if you're still using this HTML, you need to name your text area by adding
name="message"
to your opening <textarea>
tagI am not getting the message part of the form. I get an email, but no message. With the exception of the persons email and phone number.
No message.
so if I were to add the name="message" would it be like this
no,
<textarea name="message" required>
, same as for <input>
tags
I hope I got it right this time. I want to learn this, so I have to figure out what to do.
I don't think you're allowed to have tags inside of a textarea tag, honestly
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
this says you can only have text in there
the name attribute looks good though
what's the url you're visiting to view the form?
www.1kmdesigns.com
Okay, is there a youtube tutorial to see how to set it up with the code that I have?
and thankyou
the MDN article has a lot of examples... You probably want this though:
on your website, the textarea doesn't have a name
Okay, I am going to compare with he code, I want to see where my mistake is first.
what he wrote is what you want
huh, okay, I am going to fix, I will see what to do
the mistake is that form elements (like input and textarea) need a name, otherwise they don't get sent along with the form submission
by the way, completely aside from everything here...
YOUR PAGE IS A MASSIVE SECURITY BLACKHOLE
Okay, that makes sense
Yeah, I am trying to work on that. I am new to web developement
my advice: do not send emails
I am not sure how to add more security.
well, it's easy-ish
create an admin page for you, where you can see the messages sent
those messages are stored in a database
you can use sqlite, or mysql, it doesn't matter
then, you make yourself check everyday to know how many messages you have
or have it send you an email at the end of the day, with how many messages you have, if you have any
you have to do some validation on the server side, as client side validation is as useless as the paper it is written on
it's amazing for quick feedback, but that's it
on the server side, you also have to sanitize the data - like removing tags and other weird garbage
Yes, all I need is someone to send a quick email and then I respond. Which one would you suggest sqlite or mysqul?
it depends on your host
sorry mysqul
I have bluehost
you have access to mysql, you showed a screenshot of phpMyAdmin earlier
just use mysql then
Yes I do
okay
I'd recommend looking up a bunch of tutorials though, setting that up goes quite a bit beyond the scope of a forum post. Make sure to read up on SQL injection prevention, and using prepared statements
if you have questions, please open a new post with a descriptive title. This one's already wildly off topic, and ideally each post has a single topic
another thing, to reduce spam, you should use a token, which you store in a session. then, you compare it. if it is the same, process the rest of the input. if it is different or missing, or no session exists, then you have to return a message saying that everything was sent
but yes, this is getting wildly off-topic
it's my fault
by the way, you're loading the same script 3 times
Okay I will look into all of this, I will checkout the script
good luck
Thanks, also where it says
I dont need it to say Type Your Message Here... because I have it moving up and down when you put your cursor inside the text area. When I add in that part of the code, it shows up. In grey in front of the one I already have. The area kinda animates up and down.
remove the placeholder then
okay
is everything working?
All I did was delete just the part that said "Type Your Message Here..."
So now it worked great
no, i mean, do you still have problems getting the values and the error 404?
I have not checked it out yet, but i think it will work.
I also remember setting up mysql 14yrs ago when I got out of web development. I knew very little at that time as well. I recognize the program that I downloaded.
you shouldnt need to set it up, it's usually set by the host
I setup the MySQLWorkbench that year. Sorry, I had to clarify
I do have an admin. I just am not sure how to secure it to the contact page. I am looking it up on youtube right now
just use pdo and prepared statements
OKay, this what I am getting. I still dont get the message in the email. I do receive the emails that are sent.
can you show a new copy of the code that sends the email?
sure
I will send the HTML and the PHP
alright
that's the whole code in
process_form.php
?Yes, a developer helped me with that, I believe that is the entire code for the contact page. This is all that the developer helped me with awhile back, but I had problems with it.
i don't see anything wrong
I Know, but I am not sure as to why I only get the email address with a phone number from the contact page and not a message with the email.
this is what's being sent
this is the element inspector
the code you sent here doesn't correspond to the code you have on the website
Okay, I am trying to get the code to match, but I cant seem to get it to work lol
well, that's very outside the scope of this
how are you even sending the code to the website?
Yes I keep updating but the code wont update at all
I am uploading it to the file manager
do you know if you have some sort of cache enabled?
I am not sure, let me look that up
Okay, I located the cache and deleted and restored it
nope. im sure you're editing the wrong file
are you editing the index.php file?
or index.html?
I edited the index.html I left the php alone
OKay it is now working!!!!
Really quick, I cant find a tutorial on hot meet web regulations for my website. all I find is for Wordpress.
now it should work properly
Yes it is. I want to add in a way for the page to re-rout back to my website after people have sent an email to me
well, considering the issues i've pointed out for you, you should take care of those before moving forward
and im not joking
your website is a walking virus, waiting to pounce on you
Yeah, am not sure how to do this. I updated teh PHP, I also did the MySQL. for my website
you don't have to do anything super complicated
are you sure you REALLY REALLY REALLY want to send emails?
Okay, I was able to add the emails to my computer through the apple mail. so now I believe I validated things.
What can I do to know that my website is secured. I do have an SSL, the FTP I am not sure how to do that.
Okay, I was able to add the emails to my computer through the apple mail. so now I believe I validated things.all you did was to login into your email client, you didn't validate anything on the server side
What can I do to know that my website is secured. I do have an SSL, the FTP I am not sure how to do that.this is a very loaded question that should be asked in a different post. but in short: you're not
OKay
What Community do I have to go for this kind of help?
#back-end
OKay thanks
just remember that im not a moderator
OKay I will. I turned on Domain Security, and my DNSSEC. I am looking into the Verification.