473,416 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

how to make a custom contact form using HTML and CSS.

2 2Bits
hey i am running a website. i want to make a custom contact form for users using HTML CSS. can anyone guide me or have a code related to this please send me.
Feb 23 '21 #1
3 3518
AjayGohil
83 64KB
Hello,

Refer to the following site:
https://www.w3schools.com/howto/howt...ntact_form.asp
Feb 24 '21 #2
prasanthp
2 2Bits
Hey hi,

The HTML form is used to collect the user inputs. HTML provides a <form> tag to create forms. To take input from the user we use the <input> tag inside the form so that all collected user data can be sent to the server for processing. There are different input types like ‘button’, ‘checkbox’, ‘number’, ‘text’, ‘password’, ‘submit’ etc.

<form action="/submit_data.php">
<label>Enter your name: </label>
<input type="text" name="name" />
<label>Enter Mobile number </label>
<input type="number" name="mobile_no"/>
<input type="submit" value="Submit">
</form>

Additionally, you could visit W3Schools for more information.
Feb 24 '21 #3
bakertaylor28
45 32bit
While you can use a form with html alone, you need php or something similar to be able to do anything with the post data you get back from the form.

Therefore, you would do something like this in a php file. In this case, the form submits back to the same file and the php then executes the code to do something with name. It is important that we place the php code first, and then do the HTML code second. (Otherwise we have to configure the server to execute html documents as php code.) If we want to submit the form elsewhere, we put a file path in action attribute of the form, For example:
Expand|Select|Wrap|Line Numbers
  1. <form action="/foo.php">
  2.  
will submit the form to foo.php located in the root directory of the server (in which case we would put the everything from <?php to ?> in the foo.php file.) the first forward slash assumes the server root.

In this case we submit the form to self, and simply echo the name to output it to the screen:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <?php
  3. if ( !isset($_POST['name']) ) {
  4. // !isset means "not set", $_POST['name'] is the post data for the name field sent to php by the HTML code. 
  5. echo ' some error message if there is no input for name';
  6. exit;
  7. } elseif ( isset($_POST['name]) ) {
  8. //  isset is the oposite of !isset . We then grab the post data to a php variable to make it 
  9. //  easier to work with, and then do whatever you want to do with the data. here, we simply print it to the screen using echo.  
  10. $name = $_POST['name'];
  11. echo $name;
  12. } else {
  13. //error message to do if we got post data for name, but the code can't execute.
  14. echo 'there was an unidentified error';
  15. exit;
  16. }
  17. //continue php code here after we have dealt with working with name.
  18. exit;
  19. ?>
  20.  
  21. <!DOCTYPE html>
  22.      <head>
  23.      </head>
  24.      <body>
  25.  
  26.           <form action="" method="post">
  27.           <label for="name">Enter your name: </label>
  28.           <input type="text" name="name" placeholder="your name here" id="name" required />
  29.           </form>
  30.  
  31.      </body>
  32. </html>
  33.  
Feb 25 '21 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Luiz Siqueira Neto | last post by:
Somebody know how make html forms or python forms inside html to use as gui application? The idea is make a client application like a web site of my interprise for customers who don't have good...
1
by: Keith | last post by:
A2003, Xp Pro. I've designed a form which contains 6 of combos. Three on the left are set up to select fields from a query, three on the right are set up to select values from the corresponding...
7
by: Nerrad | last post by:
Hi, i am currently working on a project which requires me to create a form to allow the user to change their password. I know there is a user-level security login which is easier and safer but...
3
by: John | last post by:
What is the easiest way to make the contact form show on the front page. Meaning on want to keep the front html page and when someone clicks on the contact us link the front page remains the same,...
3
by: mirkobonet | last post by:
The idea is creating a contact form using mailto so it work with the regular mail program. (the server doesn't support php or asp) I created the form and the function is function mailMe(form){...
1
by: mgayathri2006 | last post by:
how to resize a frame in the form using html script
6
by: Palehorse | last post by:
I'd like to apologize upfront for me saying "I'm not a programer", I'm sure you all hear this a hundred times a day. Unfortunately, in this case, it's true. I've been working on trying to figure out...
4
by: luke noob | last post by:
This is my HTML... <head> <script type="text/javascript" src="js/jquery-1.2.6.pack.js"></script> <script type="text/javascript" src="js/script.js"></script> </head> <body>
0
by: ukisa4 | last post by:
Hello! I'm making some HTML test/quiz. And there i have combo boxes (drop down list) and radio buttons which have some questions. So i want to use some "if" statement if exist in any language...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.