Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 722561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:00:17+00:00 2026-05-14T06:00:17+00:00

I am trying to code an all in one HTML/PHP contact from with error

  • 0

I am trying to code an all in one HTML/PHP contact from with error checking.
When I load this file in my browser there is not HTML. I am a newb php programmer so most likely forgot something pretty obvious.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>All In One Feedback Form</title>
</head>

<body>


<?
$form_block = "
<input type=\"hidden\" name=\"op\" value=\"ds\">
<form method=\"post\" action=\"$server[PHP_SELF]\">
<p>Your name<br />
<input name=\"sender_name\" type=\"text\" size=30 value=\"$_POST[sender_name]\" /></p>
<p>Email<br  />
<input name=\"sender_email\" type=\"text\" size=30 value=\"$_POST[sender_email]\"/></p>
<p>Message<br />
<textarea name=\"message\" cols=30 rows=5 value=\"$_POST[message]\"></textarea></p>
<input name=\"submit\" type=\"submit\" value=\"Send This Form\" />

</form>";

if ($_POST[op] != "ds") {
 //they see this form
 echo "$form_block";

} else if ($_POST[op] == "ds") {


 if ($_POST[sender_name] == "") {
  $name_err = "Please enter your name<br>";
  $send = "no";
}

 if ($_POST[sender_email] == "ds") {
  $email_err = "Please enter your email<br>";
  $send = "no";
}

 if ($_POST[message] == "ds") {
  $message_err = "please enter message<br>";
  $send = "no";
}

 if ($send != "no") {
  //its ok to send
  $to = "jack@xxxxxxx.com.au";
  $subject = "All in one web site feed back";
  $mailheaders = "From: website <some email address@hhhh.com> \n";
  $mailheaders .= "Reply-To: $_POST[sender_email]\n";
  $msg = "Email sent from this site www.ccccc.com\n";
  $msg .= "Senders name: $_POST[senders_name]\n";
  $msg .= "Sender's E-Mail: $_POST[sender_email]\n";
  $msg .= "Message: $_POST[message]\n\n";
  mail($to, $subject, $msg, $mailheaders);

  echo "<p>Mail has been sent</p>";
}

else if ($send == "no") {
 echo "$name_err";
 echo "$email_err";
 echo "$message_err";
 echo "$form_block";
}

}

?>

</body>
</html>

FYI I am trying the example from a book named PHP 6 Fast and Easy Wed Development

UPDATE!!!

The code I see via view source is this.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>All In One Feedback Form</title>
</head>

<body>



<input type="hidden" name="op" value="ds">
<form method="post" action="">
<p>Your name<br />
<input name="sender_name" type="text" size=30 value="" /></p>

<p>Email<br  />
<input name="sender_email" type="text" size=30 value=""/></p>
<p>Message<br />
<textarea name="message" cols=30 rows=5 value=""></textarea></p>
<input name="submit" type="submit" value="Send This Form" />

</form></body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:00:18+00:00Added an answer on May 14, 2026 at 6:00 am

    You can use html with php as follows

    <?php if ($_POST[op] != "ds") {  ?>
    
    <input type="hidden" name="op" value="ds">
    <form method="post\" action=\"$server[PHP_SELF]\">
    

    /* your html code here */

    </form>";
    
    <php } else if ($_POST[op] == "ds") {  ?>...............
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 493k
  • Answers 493k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can't affect the expires headers of images served from… May 16, 2026 at 10:53 am
  • Editorial Team
    Editorial Team added an answer How about this one (with source code). May 16, 2026 at 10:53 am
  • Editorial Team
    Editorial Team added an answer SO considers questions and answers to be the same thing… May 16, 2026 at 10:53 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am trying to integrate some third party tracking code into one of my
I have this string containing a large chunk of html and am trying to
I have this table in some code; <table> <tr><td align=left>One</td><td align=center>Two</td><td align=right>Three</td> <tr><td align=left>One</td><td
I am trying to code a custom url_rewriter for squid. & also with using
I want to pass php variable value as a action to html form. I
I'm trying to implement a stateful web service in PHP using the SOAP extension.
I'm a bit stuck trying to get my code to output correctly, see below.
I am trying to set a 9-patch image as the background for one of
As an exercise, I've been trying out various ways of generating all permutations of
how do i implement paging on xml data which is being called through php.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.