Jump to content

web dev: how can I get inputs from an user, do something with them, and then send them elsewhere? like a mail contact form?

12345678

I've been looking around, but unfortunately I think that I haven't understood anything

html and css looks like for eastetics

JavaScript for data manipulation

 

then for getting and use inputs, like in a contact form or something, what should I look at? there are like any specials (free) libraries to use or what?

Link to comment
Share on other sites

Link to post
Share on other sites

user input can be gathered in normal JS directly on the webpage and it can be used to change what you see on the page itself. if you want to collect that input and use it to, say, send an email then you need a backend, meaning code that runs on your server and not on the webpage itself.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

56 minutes ago, Sauron said:

user input can be gathered in normal JS directly on the webpage and it can be used to change what you see on the page itself. if you want to collect that input and use it to, say, send an email then you need a backend, meaning code that runs on your server and not on the webpage itself.

doesn't exist then some sort of framework that includes all of that, backend/frontend an whatever, without making me also get into security issues because of my incompetence?

 

I've seen django, but looks like more backend?

Link to comment
Share on other sites

Link to post
Share on other sites

35 minutes ago, 12345678 said:

doesn't exist then some sort of framework that includes all of that, backend/frontend an whatever, without making me also get into security issues because of my incompetence?

sure, node.js is one. django also works.

36 minutes ago, 12345678 said:

I've seen django, but looks like more backend?

you won't be writing python code in your web pages but you don't need to worry about manually connecting them to a django backend, there is special syntax for that that python uses to generate the frontend.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

PHP is server side scripting language.

User can submit all the information in a regular form in the html page, the web server passes the form data to PHP script running on the server, and the php script can add the information to a database, build an email, connect to a mail server and send the email or connect to an email delivery service api to send an email.

 

example  a  contact page

 

<?php

$submitted = isset($_REQUEST['submitted']) == true ? true : false;
if ($submitted==true) {
   // user hit the Send button on the form so do something with the data in the form
  $name = $_REQUEST['name'];
  $email = $_REQUEST['email'];
  $message = $_REQUEST['message'];
  // insert the above into a database here 
}
?>
<html>
  <head>
    <title>Contact us</title>
  </head>
<body>
  <h1>Contact</h1>
  <?php 
  if ($submitted==true) { 
    echo '<p>Thank you. Message saved.</p>';
  } else {
    echo '<p>Please fill the form below and hit Send when ready.</p>';
?>
  <form method="post" name="contactform" action="contact.php" >
    <label for="name">Name:</label><br/>
    <input type="input" name="name" value="" /><br/>
    <label for="email">Email:</label><br/>
    <input type="input" name="email" value="" /><br/>
    <label for="msg">Message:</label><br/>
    <textarea name="msg" placeholder="Please type your message here"></textarea><br/>
    <input type="hidden" name="submitted" value="sending a hidden key as a easy way to detect that we received form data" />
    <input type="submit" name="send_button" value="Send" />
  </form>
<?php
  }
?>
</body>
</html>

 

Link to comment
Share on other sites

Link to post
Share on other sites

11 hours ago, 12345678 said:

I've been looking around, but unfortunately I think that I haven't understood anything

html and css looks like for eastetics

JavaScript for data manipulation

 

then for getting and use inputs, like in a contact form or something, what should I look at? there are like any specials (free) libraries to use or what?

You'll need some form of "backend" which Marushim has provided some code for PHP.
PHP is a great language, and there are many options.

 

If you're not super good at picking up on code, you can write javascript syntax using something called Node if I remember correctly as a "back end."
It's also possible that there's a front end api you can find online that may be JavaScript compatible.

Front end isn't my specialty, but from my understanding, that's how it works.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×