Friends,
Hello, how are you? I'm a beginner in web designing and am not finding a solution for this problem I have, but I'm sure it must be very simple for you experts. 🙂
I'm creating this website, a kind of BLOG for my pupils (I'm a teacher). There will be lots of downloadable files related to the classes already given. I tried to create it using an ordinary blogger website, but the web space provided on most of these bloggers is very small and, in intention to avoid "mirroring" for those files, I prefered to create my own site (blogger) and host it in one single server (which provides large web space), instead of using ordinary bloggers.
Another reason why I've chosen to do that is the option "Comments" provided by bloggers. Most of them allows visitors to type their comments and, after clicking the SEND button, their messages are automatically posted. To protect the site against misuse, I intend to do the following...
Visitors type their comments. These messages are sent to my email and, after analysis of their contents, I myself post their messages. That's it. So, here's my doubt...
Example:
(It's sort like the operation scheme of the foruns.)
I've got several posts in one page. Each post has 2 links by default: Comments (visitors click and send their own comments to my email) and Send to friend (visitors send the www address and the number of the post to a friend's email). If I learn how to create one, obviously I learn how to create both, therefore I'm gonna talk about the link "Comments" only.
http://blogparatestes.bigblogger.com.br/
This is a web blogger which I created to "study" its source code.
This site is in Portuguese, for I am Brazilian. Here are some translations:
para = for
testes = tests
comentários = comments
enviar para um amigo = send to friend
enviar formulário = send form
nome = name
meu = my
I found out that when clicking the link "Comentários", a JavaScript code sends the number of the post (id_post) to a page called "comentarios.php".
Here's the code...
<a href="javascript:func_janela('comentario','/comentarios.php?id_post=3E059059063076129',400,350);">Comentários (0)</a>
This page is opened in a new window. It has a form. The number of the post (id_post) is automatically loaded inside one of the lines of the form (obviously, to be sent to my email with the data filled in the form).
Here's the line...
<input type="hidden" name="id_post" value="3E059059063076129">
After clicking on the "Enviar formulário" button, a PHP code captures the data from each INPUT of the FORM and send them to my email. I've already made a draft for this code by myself.
Here's my draft for the code...
<?php
$id_post = $_GET["id_post"];
$nome = $_GET["nome"];
$mail = $_GET["mail"];
$msgm = $_GET["msgm"];
mail("meuemail@email.com","Fale conosco","ID Post: $id_post <br> Nome: $nome <br> Email: $mail <br> Comentário: $msgm","From: $ed_email\nContent-Type: text/html; charset=us-ascii");
?>
I'm not sure if this is the right way to make it, but in other tests I've made, it worked out. 🙂
Now what I want to know is...
How is the structure of the code which makes that [input type="hidden" name="id_post" value=""] receives the value from the number of the clicked post (id_post)? Is there any specific code just for that? How is it like? Where is it located? Inside the "comentarios.php" file itself?
Another doubt... The parameter ACTION of the FORM calls the page itself, I mean, it calls a PHP code which is located inside the "comentarios.php" file itself. How is this code like? (The code above, which I've made a draft, I've tested it in a separated file, that's why I said it worked out.) How do I put all these PHP codes in the same file?
Well, that's it! Sorry for the long text. If someone has pacience, time and a good heart to explain that to me with a few examples, I will really appreciate that. Really, really!
I've searched in some PHP tutorials pages, but as I don't know much about PHP language, I couldn't find exactly what I need.
I accept any easier suggestions (as another language - ASP, Java, whatever), if possible.
Thank you all very much for your atention. 🙂
Hugz.
Bruno