Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › HTML data form, PHP 500 error when running the script..
New Posts  All Forums:Forum Nav:

HTML data form, PHP 500 error when running the script..

post #1 of 3
Thread Starter 
I'm trying to create an HTML data form that sends me an email after the data has been submitted, I got the variables right , but after submitting the form I get a PHP 500 error that I assume is coming from the PHP script..

I have this on my page registro.html:
Warning: Spoiler! (Click to show)
Code:
<html>
<title>Forma de Registro</title>
<head>Enviar forma de Registro:</head>
<body>

<form action="registro.php" method="post">

        <p>Nombre <input type="text" name="Name" size="50"></p>
        <p>Dirección: <input type="text" name="Address" size="50"></p>
        <p>Ciudad: <select size="1" name="City">
                <option>San Jose</option>
                <option>Alajuela</option>
                <option>Heredia</option>
                <option>Otra</option></select></p>

<p>Entrega a Domicilio? Yes <input type="checkbox" name="Entrega" value="ON"></p>

<p><input type="submit" value="Submit" name="Submit"><input type="reset" value="Reset" name="Reset"></p>

</form></body></html>

And then have this under my PHP script page called registro.php:
Warning: Spoiler! (Click to show)
Code:
<?php
  $name = $_POST['Name'];
  $email = $_POST['Email'];
  $address = $_POST['Address'];
  $city = $_POST['City'];
  $delivery = $_POST['Delivery'];
?>

<?php
  $email_from = 'ventas@intershipcr.com';
  $email_subject = "Nuevo Usuario";
  $email_body = "Nuevo usuario: $name.\n"
                  "Correo: $email.\n"
                  "Direccion: $address.\n"
                  "Ciudad: $city.\n"
                  "Entrega: $message.\n".
?>
<?php
  $to = "ventas@intershipcr.com";
  $headers = "From: $email_from \r\n";
  mail($to,$email_subject,$email_body,$headers);
?>


What am I doing wrong..?

Edited by kpriess - 3/25/13 at 10:45am
Luftwaffe
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel 4930k ASUS Rampage IV Formula EVGA GTX780 SLI Corsair Dominator Platinum 
Hard DriveHard DriveOptical DriveCooling
Crucial M4 Barracuda 1TB No thanks.. Corsair H80 
OSMonitorKeyboardPower
W7 64 Ultimate ASUS PB27Q Corsair K70 Corsair TX850M 
CaseMouseAudio
SilverStone Raven II Logitech G9 Creative Tactic3D Rage 
  hide details  
Reply
Luftwaffe
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel 4930k ASUS Rampage IV Formula EVGA GTX780 SLI Corsair Dominator Platinum 
Hard DriveHard DriveOptical DriveCooling
Crucial M4 Barracuda 1TB No thanks.. Corsair H80 
OSMonitorKeyboardPower
W7 64 Ultimate ASUS PB27Q Corsair K70 Corsair TX850M 
CaseMouseAudio
SilverStone Raven II Logitech G9 Creative Tactic3D Rage 
  hide details  
Reply
post #2 of 3
In your php you have to concatenate the strings in the email body and close with a semicolon, that might be the reason.
Code:
<?php
  $name = $_POST['Name'];
  $email = $_POST['Email'];
  $address = $_POST['Address'];
  $city = $_POST['City'];
  $delivery = $_POST['Delivery'];
?>

<?php
  $email_from = 'ventas@intershipcr.com';
  $email_subject = "Nuevo Usuario";
  $email_body = "Nuevo usuario: $name.\n" . 
                  "Correo: $email.\n" . 
                  "Direccion: $address.\n" . 
                  "Ciudad: $city.\n" . 
                  "Entrega: $message.\n";
?>
<?php
  $to = "ventas@intershipcr.com";
  $headers = "From: $email_from \r\n";
  mail($to,$email_subject,$email_body,$headers);
?>
My System
(16 items)
 
  
CPUMotherboardGraphicsRAM
i7 920 @ Stock Asus P6T ATI HD5870 OCZ 6GB 1333mhz 
Hard DriveHard DriveOptical DriveCooling
Samsung 840 Evo Caviar Black 640GB LG DVD Drive Cm Hyper 212+ 
CoolingOSMonitorPower
Arctic Cooling Accelero Twin Turbo II Windows 7 64bit ASUS VW246H Corsair HX850 
Case
CM 690 II Adavanced 
  hide details  
Reply
My System
(16 items)
 
  
CPUMotherboardGraphicsRAM
i7 920 @ Stock Asus P6T ATI HD5870 OCZ 6GB 1333mhz 
Hard DriveHard DriveOptical DriveCooling
Samsung 840 Evo Caviar Black 640GB LG DVD Drive Cm Hyper 212+ 
CoolingOSMonitorPower
Arctic Cooling Accelero Twin Turbo II Windows 7 64bit ASUS VW246H Corsair HX850 
Case
CM 690 II Adavanced 
  hide details  
Reply
post #3 of 3
Thread Starter 
Quote:
Originally Posted by the_dude View Post

In your php you have to concatenate the strings in the email body and close with a semicolon, that might be the reason.

Thanks a lot man..! That was it..!
Luftwaffe
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel 4930k ASUS Rampage IV Formula EVGA GTX780 SLI Corsair Dominator Platinum 
Hard DriveHard DriveOptical DriveCooling
Crucial M4 Barracuda 1TB No thanks.. Corsair H80 
OSMonitorKeyboardPower
W7 64 Ultimate ASUS PB27Q Corsair K70 Corsair TX850M 
CaseMouseAudio
SilverStone Raven II Logitech G9 Creative Tactic3D Rage 
  hide details  
Reply
Luftwaffe
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel 4930k ASUS Rampage IV Formula EVGA GTX780 SLI Corsair Dominator Platinum 
Hard DriveHard DriveOptical DriveCooling
Crucial M4 Barracuda 1TB No thanks.. Corsair H80 
OSMonitorKeyboardPower
W7 64 Ultimate ASUS PB27Q Corsair K70 Corsair TX850M 
CaseMouseAudio
SilverStone Raven II Logitech G9 Creative Tactic3D Rage 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Web Coding
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › HTML data form, PHP 500 error when running the script..