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

Related Questions

I am trying to load a html page through UIWebview.I need to disable all
I'm trying to build a Chrome browser extension, that should enhance the way the
I'm trying to write test harness for part of my Android mapping application. I
I'm trying to build a C++ extension for python using swig. I've followed the
I am trying to redirect to a specific path based on HTTP_HOST or SERVER_NAME
I am trying to understand the practical difference during the execution of a program
I am playing with TFS 2010, and am trying to setup a build process
I have several USB mass storage flash drives connected to a Ubuntu Linux computer

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.