Simple web contact form

user profile photouser profile photouser profile photo2381 developers have joined this project.

Discussion

Ask questions, discuss different approaches, and share your thoughts about this project.

Anonymous User
Meeloun EducationMeeloun Education

选择合适的代写者是确保Java代写 https://www.lunwentop.net/java-daixie/ 质量的关键步骤。学生在选择代写机构时,应当仔细考察其提供的代写者资质。大多数专业的代写机构会提供代写者的学术背景、工作经验和擅长领域。学生可以根据自己的学科领域和具体需求选择最合适的代写者。此外,与代写者进行初步沟通也是必要的。通过与代写者的直接交流,学生可以进一步了解其专业水平和写作能力,确保其能够胜任任务。选择一个与自己需求匹配、沟通顺畅的代写者,可以大大提高作业的完成质量。

Adder AllzAdder Allz

It also features a prominent ledge that, while not wide enough to place toiletries on marble gazebo, or rest against stone tubs, still provides a strong lip to the bathtub’s bowl shape and prevents the design from looking visually flat.

Adder AllzAdder Allz

Being the perfect combination of fun Buggy Rentals and pricing, they offer you an experience you won’t be able to forget. We offer a number of packages that include different buggies for different durations.

John OlayiwolaJohn Olayiwola

Hi everyone.
I have completed this challenge in PHP. I created a public git repo and moved the files there. But when I published the site, it gave a 404 error.
Kindly guide me on how to move a PHP file and database to git repository.
Thank you

Removed UserRemoved User

We insist on that when we give customer detergent manufacturing plant the benefit and assurance, we also contribute to the continuous development of energy in china and improvement of people’s life.

Nelson ZakayoNelson Zakayo

Hello everyone,
I want to create a form using html basing on this contact form now should this be done in form of different programming languages

Alden BrownAlden Brown

Hello everyone; I hope you are well!
am new to php and want to create a (valid) form in php. I'm trying something but the form still returns even when some required fields are empty.
this is my php code.
Thank you in advance for your help.

<?php $nameErr = $emailErr = $commentErr = ""; $name = $email = $gender = $comment = ""; if ($_SERVER["REQUEST_METHOD"] == 'POST') { function validateEmail($isGoodEmail): string { if (!isset($_POST['email']) || !empty($_POST['email']) || filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $isGoodEmail = $_POST['email']; $message = 'email:' .$isGoodEmail; return $message; } else { return 'please the Email is mandatory!'; } } function validateName($isGoodName): string { if (isset($_POST['username']) || (!empty($_POST['username']))) { $isGoodName = $_POST['username']; $message = 'name:'.$isGoodName; return $message; } else { $nameErr = "You must enter the name"; return $nameErr; } } function isComment($isComment): string { if (isset($_POST['comment']) && $_POST['comment'] !='') { $isComment = $_POST['comment']; $message = 'comment:'.$isComment; return $message; } else { return 'please the comment is mandatory!'; } } } ?>

Voici les données que vous avez entrées:


<?php if (validateEmail($_POST['email']) && validateName($_POST['username']) && validateName($_POST['comment'])) { echo 'email:' .htmlspecialchars($_POST['email']). '
'; echo 'name:'.htmlspecialchars( $_POST['username'] ). '
'; echo 'request type:'.htmlspecialchars($_POST['dropdown']). '
'; echo 'your comment:' .htmlspecialchars($_POST['comment']); } else { echo 'enter email please'. '
'; }
J. Lawrence WalkollieJ. Lawrence Walkollie

Some help please, this is my first time working on a project or getting my hands dirty with code.
My codes are only php, No javascript.
I successfully passed the form data to the Message Received page but the problem is that the form is not being validated though I believe that I implemented the necessary php validation code, the data still being submitted, whether the user leave the form empty, input less the the minimum character or input the wrong data, the form is be submitted successfully. This is my validation code.

<?php $username = $email = $issue = $message = ""; $usernamerr = $emailerr = $issuerr = $messagerr = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { // Validate the username field if (empty($_POST["username"])) { $usernamerr = "Please enter your name."; } elseif(strlen($_POST["username"]) < 3) { $usernamerr = "Your name must be atleast 3 characters."; } else { $username = test_input($_POST["username"]); // Ensure that username contains only letter and white spaces if (!preg_match("/^[a-zA-Z-' ]*$/", $username)) { $usernamerr = "Your name can contain only letters and white spaces."; } } // Validate the email field if (empty($_POST["email"])) { $emailerr = "Please enter your email."; } else { $email = test_input($_POST["email"]); // Ensure that email address is proper if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailerr = "Invalid email formart"; } } // Validate the issue field if (empty($_POST["issue"])) { $issuerr = "Please select an issue."; } else { $issue = test_input($_POST["issue"]); } // Validate the message field if (empty($_POST["message"])) { $messagerr = "Please explain the issue you have."; } elseif(strlen($_POST["message"]) < 30) { $usernamerr = "Your message must be atleast 3 characters."; } else { $message = test_input($_POST["message"]); } } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?>
pfigzpfigz

I think you need to add an exit, so that the script stops the form submission if the error conditions are met.

pfigzpfigz

Hi all,

I was able to implement the most basic functions of this project and am now trying to add the bonus features. I am stuck on creating an 'Edit' button, however. Anyone have suggestions on how to submit the data back to the original form? Do I have to create a session, or use Jquery/Ajax to accomplish this? I am not using a database for my solution as of yet.

Thanks!

pfigzpfigz

I was unsuccessful in implementing jQuery/AJAX for editing the form, but I landed on a simple solution - using a hidden form field to populate and send data back to the original form.

ROHIT DUBEYROHIT DUBEY

Hey, guys how r u?

OrangepeelOrangepeel

So I started my project with an HTML file and using PHP I wrote down my PHP file code;
'''

<html> <body> Hello <?php echo $_POST["fname"];?>
Here's what we got from you:
First name: <?php echo $_POST["fname"]; ?>
Last name: <?php echo $_POST["lname"]; ?>
Email Adress: <?php echo $_POST["email"]; ?>
User's Issue: <?php echo $_POST["UserIssue"]; ?>
User Specification: <?php echo $_POST["Comments"]; ?>
</body> </html> ''' However when the user submits the form, the server displays the code as it is, in place of the form recorded response, why is it so?
Michael PhelpsMichael Phelps

If using PHP it has to be done in a .php file (not .html) a PHP file will allow both PHP and HTML elements. - With PHP being server-side code, if not running it on a hosting package you can use one of the local web servers listed in the projects (XAMPP or WAMP) which will allow you to run PHP files from your computer.

OrangepeelOrangepeel

Hey, say I don't know how to use php, can I use JavaScript and Firebase ?
Also would it be useful to learn php?

Michael PhelpsMichael Phelps

Hello!
Tackling the problem in other ways is absolutely fine! There is always more than one way to do something and no one way is the 'correct' way. By all means, feel free to do this project with other languages - It's purpose however is to practice PHP.

One strong case for PHP is that it is serverside so the client doesn't run the code, the server does, this is more secure than Javascript. It is possible to run Javascript serverside but this would involve running NodeJS which can be significantly more expensive to run than your typical web server (If using a web host).

There are arguments for and against each language but I personally am an advocate for PHP.

NehaNeha

hiii

fares shehabifares shehabi

hellooz

isauraisabel5isauraisabel5

Hi! Question, I haven't started learning php yet, is it possible to do this project without php?

Michael PhelpsMichael Phelps

Hi,
It is possible to do part of this project without PHP. The form and styling elements are just HTML and CSS. Those two alone make good styling practice!
To get the form to function and submit content to either a page or database requires something which will talk to the server such as PHP or JS.

isauraisabel5isauraisabel5

Ok, thanks!

Sheldon WilliamsSheldon Williams

I'mma attempt this when I get home

Ting ChangTing Chang

Looking forward to seeing your solution then, Sheldon!

Interested in this project?

Shorten your learning curve with on-demand programming help

The awesome set of verified mentors will provide guidance and mentoring help when you are stuck.

Suresh Atta

  • Post request free
  • First 15 mins free
Shorten your learning curve with on-demand programming help

Browse more projects

More coming soon...