`problema con "include"

Cree un archivo php (display_form.php) alojado en C:\xampp\htdocs\display_form.php y con el siguiente codigo :
<!--p<br-->/* Program name: display_form.php
* Description: Script displays a form.
*/
include("form_phone.inc");
?>
Al ejecutar la página "deberia" ejecutar el formulario "form_phone.inc", pero me arroja el siguiente error:
Parse error: parse error, expecting `')'' ¿in c:\xampp\htdocs\form_phone.inc on line 6
donde esta mi error?!?!?!? ESPERO PUEDAS GUIARME...
GRACIAS
en todo caso, el archivo form_phone.inc, está alojado en C:\xampp\htdocs\form_phone.inc , y su sript es:
<?php
/* Program name: form_phone.inc
* Description: Defines a form that collects a user's
* name and phone number.
*/
$labels = array( "first_name" => "First Name",
"middle_name" => "Middle Name",
"last_name" => "Last Name",
"phone" => "Phone");
$submit = "Submit Phone Number";
?>
<html>
<head>
<title>Customer Phone Number</title>
<style type='text/css'>
<!--
#form {
margin: 1.5em 0 0 0;
padding: 0;
}
#field {padding-bottom: 1em;}
label {
font-weight: bold;
float: left;
width: 20%;
margin-right: 1em;
text-align: right;
}
-->
</style>
</head>
<body>
<h3>Please enter your phone number below.</h3>
<form action='process_form.php' method='POST'>
<div id='form'>
<?php
/* Loop that displays the form fields */
foreach($labels as $field => $label)
{
echo "
<div id='field'><label for='$field'>$label</label>
<input id='$field' name='$field' type='text'
size='50%' maxlength='65' /></div>
\n";
}
echo "</div>
\n";
echo "<input style='margin-left: 33%' type='submit'
value='$submit' />\n";
?>
</form>
</body>
</html>

2 Respuestas

Respuesta
1
Lo probe y a mi me funciona, solo quite unas etiquetas repetidas, te envio las dos paginas y comparalas con las tuyas.
En la pagina form_phone. Inc debes quitar todas las etiquetas html
------------------------
display_form.php
------------------------
include("form_phone.inc");
?>
---------------------------
form_phone.inc
---------------------------
<?php
/* Program name: form_phone.inc
* Description: Defines a form that collects a user's
* name and phone number.
*/
$labels = array( "first_name" => "First Name",
"middle_name" => "Middle Name",
"last_name" => "Last Name",
"phone" => "Phone");
$submit = "Submit Phone Number";
?>
<html>
<head>
<title>Customer Phone Number</title>
<style type='text/css'>
<!--
#form {
margin: 1.5em 0 0 0;
padding: 0;
}
#field {padding-bottom: 1em;}
label {
font-weight: bold;
float: left;
width: 20%;
margin-right: 1em;
text-align: right;
}
-->
</style>
</head>
<body>
<h3>Please enter your phone number below.</h3>
<form action='process_form.php' method='POST'>
<div id='form'>
<?php
/* Loop that displays the form fields */
foreach($labels as $field => $label)
{
echo "
<div id='field'><label for='$field'>$label</label>
<input id='$field' name='$field' type='text'
size='50%' maxlength='65' /></div>
\n";
}
echo "</div>
\n";
echo "<input style='margin-left: 33%' type='submit'
value='$submit' />\n";
?>
</form>
</body>
</html>
MUCHAS GRACIAS !!! funcionó !!... ahora... PORQUÉ !... no se... simplemente copie y pegue .. no veo la diferencia... podrias decirme EXACTAMENTE cual era mi error para que en el futuro no lo repita ? gracias nuevamente !
Respuesta
Prueba a ejecutar directamente el fichero form_phone. Inc (añádele .php al nombre) y verás más claramente dónde puede estar el error.
gracias por tu ayuda.. pero al parecer era simple maña del computador... derrepente y sin hacer nada... funcionó... no tengo explicaciones...
EXITOS !

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas