Jump to content

[SOLVED] Email Form Results?


silentg0d

Recommended Posts

Hey i was wondering how i to email php form results so i looked it up and i have got pretty far but i am stuck my code doesn't seem to work properly. If anyone can check it for errors i would appreciate it.

 

 

 

 

 

<body>

<?php
if (isset($_REQUEST['Profession']))
//if "email" is filled out, send email
  {
  //send email

$Profession = $_POST['Profession'];
$SetName = $_POST['SetName'];
$HeadPiece = $_POST['HeadPiece'];
$ChestPiece = $_POST['ChestPiece'];
$ArmPiece = $_POST['ArmPiece'];
$LegPiece = $_POST['LegPiece'];
$FeetPiece = $_POST['FeetPiece'];

  mail("[email protected]", "Subject: Armor Set",
  $message, "$head -  $SetName - $HeadPiece - $ChestPiece - $ArmPiece - $LegPiece - $FeetPiece" );
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='input.php'>
  Profession: <input type='text' name='Profession'/><br />
  Armor Set Name: <input type='text' name='SetName'/><br />
  Armor Set ID(Head Piece): <input type='text' name='HeadPiece'/><br />
  Armor Set ID(Chest Piece): <input type='text' name='ChestPiece'/><br />
  Armor Set ID(Arm Piece): <input type='text' name='ArmPiece'/><br />
  Armor Set ID(Leg Piece): <input type='text' name='LegPiece'/><br />
  Armor Set ID(Feet Piece): <input type='text' name='FeetPiece'/><br />
  <input type='submit' />
  </form>";
  }
?>

Link to comment
https://forums.phpfreaks.com/topic/42070-solved-email-form-results/
Share on other sites

The action messes with the php? I do not think it does bud. Without the action you cannot tell the script where to go...grant it that this one references the same page.

 

Maybe try this

 

<body>
<?php
if (isset($_POST'Profession']))
//if "email" is filled out, send email
  {
  //send email

$Profession = $_POST['Profession'];
$SetName = $_POST['SetName'];
$HeadPiece = $_POST['HeadPiece'];
$ChestPiece = $_POST['ChestPiece'];
$ArmPiece = $_POST['ArmPiece'];
$LegPiece = $_POST['LegPiece'];
$FeetPiece = $_POST['FeetPiece'];

  mail("[email protected]", "Subject: Armor Set",
  $message, "$head -  $SetName - $HeadPiece - $ChestPiece - $ArmPiece - $LegPiece - $FeetPiece" );
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='POST' action='input.php'>
  Profession: <input type='text' name='Profession'/><br />
  Armor Set Name: <input type='text' name='SetName'/><br />
  Armor Set ID(Head Piece): <input type='text' name='HeadPiece'/><br />
  Armor Set ID(Chest Piece): <input type='text' name='ChestPiece'/><br />
  Armor Set ID(Arm Piece): <input type='text' name='ArmPiece'/><br />
  Armor Set ID(Leg Piece): <input type='text' name='LegPiece'/><br />
  Armor Set ID(Feet Piece): <input type='text' name='FeetPiece'/><br />
  <input type='submit' />
  </form>";
  }
?>

 

I do not know why you chose the request for the check in the isset when you reference the $_POST to grab the variables.

 

--FrosT

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.