Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average
Thread Closed 


[HELP] Website Functions! filter_list
Author
Message
[HELP] Website Functions! #1
Hey guys,

I'm posting this thread because I'm literally stuck. I'm a beginner with website design and I made a site. I think it's pretty good but I'm not sure what others will think. However, this thread is not a showcase.

I have 2 things on the site that I need to have but I don't know how. The first is that I need a contact form. A user should be able to submit a form with his/her name, email, and message, and that whole thing should be sent to my email. I found one on the internet and it looks like it works but I don't receive any emails, and yes, I have edited the code to include my email.

The second thing is a subscribe service. So, a user should be able to submit their email, (yes, just their email), and it should be put into a .txt file on the server in this format:

Code:
example@email.com; example@email.com; example@email.com;...

So I can quickly copy the entire thing into the send box and mass message.

Thanks for any help in advance,

Sparks


RE: [HELP] Website Functions! #2
If you want the form an easier way of doing it is by mailto.
Code:
<a href="mailto:duubz@outlook.com">Email Duubz</a>

As for the second a way of doing so is making an automated bot do it for you.

Form
Code:
<form action="action.php">
<p><input type="textbox" placeholder="Username" id="user"></input></p>
<p><input type="textbox" placeholder="Emai Address" id="email"></input></p>
<p><input type="textbox" placeholder="Name" id="name"></input></p>
<p><input type="textbox" placeholder="Message to me" id="msg"></input></p>
<input type="submit" value="Submit"></input>
</form>
(This post was last modified: 12-15-2013, 02:01 PM by Equinox.)
[Image: BXqGARG.png]


RE: [HELP] Website Functions! #3
The contact form could be done like this:

PHP Code:
<?php
$to      
'yourmailaddress here';
$subject 'Contact Form:' $their_name;
$message $user_message_input;
$headers 'From: ' $submitted_mail "\r\n" .
    
'Reply-To: ' $submitted_mail "\r\n" .
    
'X-Mailer: PHP/' phpversion();

mail($to$subject$message$headers);
?>
Edit: Confirmed Working

The subscribe function could also be solved using a database.
Here is an example of the function to write to a file:
PHP Code:
<?php
$user_input 
"mymail@mail.com" ";";
echo 
$user_input;

$file fopen("maillist.txt","a");
echo 
fwrite($file,$user_input) or die("Write error!");
fclose($file);
?>
Edit: Confirmed Working


RE: [HELP] Website Functions! #4
And you'd need to connect some sort of PHP document that stores the provided information
[Image: BXqGARG.png]


RE: [HELP] Website Functions! #5
(12-15-2013, 02:02 PM)CamIce Wrote: The contact form could be done like this:

PHP Code:
<?php
$to      
'yourmailaddress here';
$subject 'Contact Form:' $their_name;
$message $user_message_input;
$headers 'From: ' $submitted_mail "\r\n" .
    
'Reply-To: ' $submitted_mail "\r\n" .
    
'X-Mailer: PHP/' phpversion();

mail($to$subject$message$headers);
?>

The subscribe function could also be solved using a database.
Here is an example of the function to write to a file:
PHP Code:
<?php
$file_name 
'YourFileContainingEmails.txt';
$mail $user_input;
$file fopen($file_name"a");
fwrite($file$mail ";");
?>

I have not yet tested these. Will update the post soon

Sorry, I'm a beginner so I don't quite understand. Let me tell you what I gather,

I have to create a form and put 'action="phpfile.php" '
Or is it that I put this in the head and link each id?
I don't know php. When It comes to sites, I only know html, css and javascript.


RE: [HELP] Website Functions! #6
(12-15-2013, 02:09 PM)Sparks Wrote: I don't know php. When It comes to sites, I only know html, css and javascript.

I recon that you do some studying. Not only is it mandatory for user logins, but it is necessary for most big ones like Sinister for example. I also recommend learning AJAX. It is what loads the information without refreshing or changing pages. Like when you click reload on the recent forum posts widget at the bottom. That's AJAX.
[Image: BXqGARG.png]


RE: [HELP] Website Functions! #7
Yes, you have to create a form, with action = to the php file.
In the PHP file, you then got to recieve the input using:
$mail = $_POST['mail_input'];
where mail_input is then name/id of the input in form.
You have to do this on every sent argument for the PHP file to recieve (Do the same on name and message)

Sorry if you don't understand. I suck at explaining -_-


RE: [HELP] Website Functions! #8
(12-15-2013, 02:20 PM)Duubz Wrote: I recon that you do some studying. Not only is it mandatory for user logins, but it is necessary for most big ones like Sinister for example. I also recommend learning AJAX. It is what loads the information without refreshing or changing pages. Like when you click reload on the recent forum posts widget at the bottom. That's AJAX.
Thanks. I've started learning php already. I'll try research ajax.
(12-15-2013, 02:25 PM)CamIce Wrote: Yes, you have to create a form, with action = to the php file.
In the PHP file, you then got to recieve the input using:
$mail = $_POST['mail_input'];
where mail_input is then name/id of the input in form.
You have to do this on every sent argument for the PHP file to recieve (Do the same on name and message)

Sorry if you don't understand. I suck at explaining -_-

Thanks. I think I get it. I'll try it when I get back on my pc.


RE: [HELP] Website Functions! #9
(12-15-2013, 03:56 PM)Sparks Wrote: Thanks. I've started learning php already. I'll try research ajax.

Thanks. I think I get it. I'll try it when I get back on my pc.

Feel free to PM me for any more help


RE: [HELP] Website Functions! #10
(12-15-2013, 04:09 PM)CamIce Wrote: Feel free to PM me for any more help

Thanks! You're really helpful.

Code:
<form method="post" name="contact" id="contact">
       <table>
       <tr>
           <td>Your Email Address</td>
        <td><input type="text" name="email"></td>
       </tr>
       <tr>
       <td>Your Message</td>
       <td><textarea type="text" name="message"></textarea></td>
       <tr>
       <td><input type="submit" value="Submit" /></td>
       </tr>
       </table>
       </form>

I made a simple form, is it ok?
(This post was last modified: 12-15-2013, 06:24 PM by Eclipse.)








Users browsing this thread: 1 Guest(s)