SuprBay: The PirateBay Forum

Full Version: Coding a generic form
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Question: if I was to code a web page form, can I use PHP and skip Perl altogether?

My complaint is that Perl is inconvenient to use. I just gave up on it. CGI coding is not my way.

PHP is heaven.
You absolutely can.
Thank you.

#IFuckingHatePerl
Perl is pretty much a joke and no shops use it.

PHP 8.1 really is an awesome programming language...I started programming in the mid 80s in C and after 10 years of pointer errors I moved to C++ and OOP.

When i first started web development in 2001 I saw the LAMP stack as the obvious winner as its very hard to compete with free.
(Aug 16, 2022, 23:39 pm)RobertX Wrote: [ -> ]Thank you.

#IFuckingHatePerl

Perl is rather for console scripting. For web-development PHP and JavaScript (node.js) is your choice.
Yes, well you can use PHP and skip Perl altogether to create a web page form.
Code Example -

<!DOCTYPE html>
<html>
<head>
<title>PHP Form Example</title>
</head>
<body>

<h2>Contact Form</h2>

<form method="post" action="">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br><br>

<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br><br>

<label for="message">Message:</label><br>
<textarea id="message" name="message" rows="4" cols="50" required></textarea><br><br>

<input type="submit" name="submit" value="Submit">
</form>

<?php
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];

// Process the form data, e.g., send an email
$to = 'recipient@example.com';
$subject = 'New Contact Form Submission';
$messageBody = "Name: $name\nEmail: $email\nMessage:\n$message";
mail($to, $subject, $messageBody);

echo '<p>Thank you for your submission!</p>';
}
?>

</body>
</html>

Thanks
gulshan212, I thank you, but I think that I know how to code a PHP form, that's why I prefer PHP better than Perl.

But I admit fault in asking the question in the beginning. Perhaps I will learn to spare these questions.

Again, I thank you.