Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Amit Feldman
12,795 PointsGetting 404 Undefined Error while submitting form
I'm getting
Error 404 Undefined
"Not Found The requested URL /signup/undefined was not found on this server."
I created an .htaccess and deleted the file after this error. All my forms get this error after clicking send. I'm not sure what to do.
Please help :)
I attached my code (The first piece of code is under /signup/index.php. The second piece of code is under /signup/success/index.php)
Amit Feldman
12,795 Points<?php
header("Content-Type: text/html; charset=UTF-8");
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$subject = "Contacto WSNPro" . " de " . $_POST["nombre"] . " " . $_POST['apellido'];
$message .= "Nombre: " . $_POST["nombre"] . "\n";
$message .= "Apellido: " . $_POST["apellido"] . "\n";
$message .= "Email: " . $_POST["email"] . "\n";
$message .= "Empresa: " . $_POST["empresa"] . "\n";
$message .= "Cargo: " . $_POST["cargo"] . "\n";
$message .= "Teléfono: " . $_POST["telefono"] . "\n";
$message .= "Tamaño de Empresa: " . $_POST["select_empresa"] . "\n";
$message .= "Página de Origen: " . $_POST["signup_page"] . "\n";
$header = "From: " . $_POST["email"] . "\r\n";
$header.= "MIME-Version: 1.0\r\n";
$header.= "Content-Type: text/plain; charset=utf-8\r\n";
$header.= "X-Priority: 1\r\n";
//mail('name@email.com', $subject, $message, $header);
}
?>
<?php
$pageTitle = "Gracias!";
require_once("../../php/config.php");
include(ROOT_PATH . "php/header.php");
?>
<script>mixpanel.track("Página Success Formulario Reunión Enviado");</script>
<div class="signup" style="margin-top: -65px;">
<div class="container text-center sign">
<div class="col-lg-12">
<h1 style="font-size: 36px; font-weight: 300;">Agenda una reunión con nosotros.</h1>
<p style="font-size: 20px; font-weight: 100;">Descubre como WSNPro puede ayudar a tu empresa a crear
tus nuevos productos y servicios innovadores y exitosos.</p>
<div class="row">
<div class="col-md-12" style="padding: 120px;">
<h1 style="font-size: 24px; font-weight: 200;">Muchas gracias, dentro de las próximas 2 horas nos pondrémos en contacto contigo.</h1>
</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
</div>
</div>
</div>
<?php include(ROOT_PATH . "php/footer.php"); ?>
3 Answers
Amit Feldman
12,795 PointsOk, I got it sorted out. It was my fault by setting mixpanel's link tracker onto a button inside the forms.
Thanks for all the help!
Michael Collins
433 PointsWhat URL are you submitting the form to? I see that you are using the constant -> BASE_URL but I don't see that constant is defined in the code that you provided. That could be why you are getting an undefined error.
action="<?php echo BASE_URL; ?>success/"
ixrevo
32,051 PointsHi, Amit! You've said form started giving you 404 after you had created .htaccess file. Try resetting browser cache — they like saving 301 redirects and continuing redirecting you, even you've deleted .htaccess from a web server.
Amit Feldman
12,795 PointsAmit Feldman
12,795 Points