Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

50%
+0 −0
Q&A Creating a Right-To-Left, primarily-backend, HTML-PHP contact form

I host my website on a PaaS-modeled, shared hosting environment by SiteGround which is quite a well known hosting company with (as I believe) well-venerated email servers. I am trying to create ...

0 answers  ·  posted 3y ago by deleted user  ·  edited 3y ago by deleted user

Question php html contact-form
#2: Post edited by (deleted user) · 2021-03-13T07:14:31Z (over 3 years ago)
  • Creating an (RTL), primarily-backend HTML-PHP contact form
  • Creating a Right-To-Left, primarily-backend, HTML-PHP contact form
  • I am trying to create a Right-To-Left first (RTL-first) primarily backend HTML-PHP contact form.
  • If I use the following code I can submit the form and there is no error In the browser or in an autogenerated error log file but I also don't get an email.
  • I have done many tries and in one try did get an email and I am not sure if my code has become bad somewhere along the next tries or any further emails are treated by my Gmail account as spam.
  • What might be a problem in my latest code version below?
  • ## HTML
  • <!DOCTYPE html>
  • <html>
  • <head>
  • <title>יצירת קשר</title>
  • <meta charset="utf-8">
  • <link rel="stylesheet" href="./0_contact_form.css" type="text/css"></link>
  • <!-- Normally scripts comes under the <body> tag but for a contact form file here is also fine -->
  • </head>
  • <body>
  • <form dir="rtl" lang="he" method="POST" action="./0_contact_form.php" onsubmit="return redirectMe();" id="contact_form">
  • <h2>יצירת קשר</h2>
  • <p><label for="name" class="required">שם</label><input type="text" name="name" required id="cf_name"></input></p>
  • <p><label for="email" class="required">כתובת אימייל</label><input type="email" name="email" required id="cf_email"></input></p>
  • <p><label for="phone">מספר טלפון </label><input type="tel" name="phone" id="cf_phone"></input></p>
  • <!-- SPECIFICALLY ADDED WHITESPACE TO מספר טלפון -->
  • <p><label for="topic">פנייה בנושא</label> <select name="topic" id="cf_topic">
  • <option value="אבחון קידום אתרים (כמפורט במחירון)">אבחון קידום אתרים (כמפורט במחירון)</option>
  • <option value="שיווק באמצעות תוכן (כמפורט במחירון)">שיווק באמצעות תוכן (כמפורט במחירון)</option>
  • <option value="פיתוח קישורים (כמפורט במחירון)">פיתוח קישורים (כמפורט במחירון)</option>
  • <option value="ייעוץ והדרכה (כמפורט במחירון)">ייעוץ והדרכה (כמפורט במחירון)</option>
  • <option value="נגישות">נגישות</option>
  • </select></p>
  • <label for="date">תאריך רצוי לפגישה (אם יש)</label> <input type="date" name="date" id="cf_date">
  • <p><label for="notes">הערות (אם יש)</label> <input name="notes" type="text" id="cf_notes"/></p>
  • <p><input type="submit" value="שליחה"></input></p>
  • </form>
  • </body>
  • </html>
  • ## CSS
  • .required:after {content:"* "; color: red;}
  • ## PHP
  • <?php
  • $name = $_POST["name"];
  • $email = $_POST["email"];
  • $phone = $_POST["phone"];
  • $topic = $_POST["topic"];
  • $date = $_POST["date"];
  • $notes = $_POST["notes"];
  • $to = "EMAIL_ADDRESS@EMAIL_TLD";
  • $subject = "הודעת יצירת קשר";
  • $message = array (
  • $name . "שם" . "\r\n",
  • $email . "אימייל" . "\r\n",
  • $phone . "טלפון" . "\r\n",
  • $topic . "פנייה בנושא" . "\r\n",
  • $date . "תאריך רצוי לפגישה (אם יש)" . "\r\n",
  • $notes . "הערות (אם יש)" . "\r\n"
  • );
  • $headers = array(
  • "From" => $email,
  • "Reply-To" => $email,
  • "X-Mailer: PHP/" . phpversion()
  • );
  • # The order should be as above: $to, $subject, $message and $headers
  • mail($to, $subject, $message, $headers);
  • ?>
  • I host my website on a PaaS-modeled, shared hosting environment by _SiteGround_ which is quite a well known hosting company with (as I believe) well-venerated email servers.
  • ---
  • I am trying to create an RTL-first primarily backend HTML-PHP contact form.
  • If I use the following code I can submit the form and there is no error In the browser or in an autogenerated error log file but I also don't get an email.
  • What might be a problem in my latest code version below?
  • ## HTML
  • <!DOCTYPE html>
  • <html>
  • <head>
  • <title>יצירת קשר</title>
  • <meta charset="utf-8">
  • <link rel="stylesheet" href="./0_contact_form.css" type="text/css"></link>
  • <!-- Normally scripts comes under the <body> tag but for a contact form file here is also fine -->
  • </head>
  • <body>
  • <form dir="rtl" lang="he" method="POST" action="./0_contact_form.php" onsubmit="return redirectMe();" id="contact_form">
  • <h2>יצירת קשר</h2>
  • <p><label for="name" class="required">שם</label><input type="text" name="name" required id="cf_name"></input></p>
  • <p><label for="email" class="required">כתובת אימייל</label><input type="email" name="email" required id="cf_email"></input></p>
  • <p><label for="phone">מספר טלפון </label><input type="tel" name="phone" id="cf_phone"></input></p>
  • <!-- SPECIFICALLY ADDED WHITESPACE TO מספר טלפון -->
  • <p><label for="topic">פנייה בנושא</label> <select name="topic" id="cf_topic">
  • <option value="אבחון קידום אתרים (כמפורט במחירון)">אבחון קידום אתרים (כמפורט במחירון)</option>
  • <option value="שיווק באמצעות תוכן (כמפורט במחירון)">שיווק באמצעות תוכן (כמפורט במחירון)</option>
  • <option value="פיתוח קישורים (כמפורט במחירון)">פיתוח קישורים (כמפורט במחירון)</option>
  • <option value="ייעוץ והדרכה (כמפורט במחירון)">ייעוץ והדרכה (כמפורט במחירון)</option>
  • <option value="נגישות">נגישות</option>
  • </select></p>
  • <label for="date">תאריך רצוי לפגישה (אם יש)</label> <input type="date" name="date" id="cf_date">
  • <p><label for="notes">הערות (אם יש)</label> <input name="notes" type="text" id="cf_notes"/></p>
  • <p><input type="submit" value="שליחה"></input></p>
  • </form>
  • </body>
  • </html>
  • ## CSS
  • .required:after {content:"* "; color: red;}
  • ## PHP
  • <?php
  • $name = $_POST["name"];
  • $email = $_POST["email"];
  • $phone = $_POST["phone"];
  • $topic = $_POST["topic"];
  • $date = $_POST["date"];
  • $notes = $_POST["notes"];
  • $to = "EMAIL_ADDRESS@EMAIL_TLD";
  • $subject = "הודעת יצירת קשר";
  • $message = array (
  • $name . "שם" . "\r\n",
  • $email . "אימייל" . "\r\n",
  • $phone . "טלפון" . "\r\n",
  • $topic . "פנייה בנושא" . "\r\n",
  • $date . "תאריך רצוי לפגישה (אם יש)" . "\r\n",
  • $notes . "הערות (אם יש)" . "\r\n"
  • );
  • $headers = array(
  • "From" => $email,
  • "Reply-To" => $email,
  • "X-Mailer: PHP/" . phpversion()
  • );
  • # The order should be as above: $to, $subject, $message and $headers
  • mail($to, $subject, $message, $headers);
  • ?>
#1: Initial revision by (deleted user) · 2021-03-12T17:52:12Z (over 3 years ago)
Creating an (RTL), primarily-backend HTML-PHP contact form
I am trying to create a Right-To-Left first (RTL-first) primarily backend HTML-PHP contact form.

If I use the following code I can submit the form and there is no error In the browser or in an autogenerated error log file but I also don't get an email.

I have done many tries and in one try did get an email and I am not sure if my code has become bad somewhere along the next tries or any further emails are treated by my Gmail account as spam.

What might be a problem in my latest code version below?

## HTML

	<!DOCTYPE html>
	<html>
		<head>
			<title>יצירת קשר</title>
			<meta charset="utf-8">
			<link rel="stylesheet" href="./0_contact_form.css" type="text/css"></link>
			<!-- Normally scripts comes under the <body> tag but for a contact form file here is also fine -->
		</head>
		<body>
			<form dir="rtl" lang="he" method="POST" action="./0_contact_form.php" onsubmit="return redirectMe();" id="contact_form">
				<h2>יצירת קשר</h2>
				<p><label for="name" class="required">שם</label><input type="text" name="name" required id="cf_name"></input></p>
		<p><label for="email" class="required">כתובת אימייל</label><input type="email" name="email" required id="cf_email"></input></p>
				<p><label for="phone">מספר טלפון </label><input type="tel" name="phone" id="cf_phone"></input></p>
				<!-- SPECIFICALLY ADDED WHITESPACE TO מספר טלפון -->

				<p><label for="topic">פנייה בנושא</label> <select name="topic" id="cf_topic">
					<option value="אבחון קידום אתרים (כמפורט במחירון)">אבחון קידום אתרים (כמפורט במחירון)</option>
					<option value="שיווק באמצעות תוכן (כמפורט במחירון)">שיווק באמצעות תוכן (כמפורט במחירון)</option>
					<option value="פיתוח קישורים (כמפורט במחירון)">פיתוח קישורים (כמפורט במחירון)</option>
					<option value="ייעוץ והדרכה (כמפורט במחירון)">ייעוץ והדרכה (כמפורט במחירון)</option>
					<option value="נגישות">נגישות</option>
				</select></p>

				<label for="date">תאריך רצוי לפגישה (אם יש)</label> <input type="date" name="date" id="cf_date">

				<p><label for="notes">הערות (אם יש)</label> <input name="notes" type="text" id="cf_notes"/></p>
				<p><input type="submit" value="שליחה"></input></p>
			</form>
		</body>
	</html>

## CSS

	.required:after {content:"* "; color: red;}

## PHP

	<?php
		$name = $_POST["name"];
		$email = $_POST["email"];
		$phone = $_POST["phone"];
		$topic = $_POST["topic"];
		$date = $_POST["date"];
		$notes = $_POST["notes"];

		$to = "EMAIL_ADDRESS@EMAIL_TLD";
		$subject = "הודעת יצירת קשר";
		$message = array (
			$name . "שם" . "\r\n",
			$email . "אימייל" . "\r\n",
			$phone . "טלפון" . "\r\n",
			$topic . "פנייה בנושא" . "\r\n",
			$date . "תאריך רצוי לפגישה (אם יש)" . "\r\n",
			$notes . "הערות (אם יש)" . "\r\n"
		);
		$headers = array(
			"From" => $email,
			"Reply-To" => $email,
			"X-Mailer: PHP/" . phpversion()
		);
		# The order should be as above: $to, $subject, $message and $headers
		
		mail($to, $subject, $message, $headers);
	?>