Ver Mensaje Individual
  #14 (permalink)  
Antiguo 11/12/2007, 10:07
Javichechu
 
Fecha de Ingreso: junio-2007
Mensajes: 327
Antigüedad: 16 años, 10 meses
Puntos: 0
Re: Ayuda con PHP, toy desesperado

Cita:
Iniciado por GatorV Ver Mensaje
Que editor estas utilizando?, al parecer tienes un problema con tus rutas y con la instalacion de PHP que tienes.

Saludos.
el phpeditor Más evidente complicado XD

Es que no me reconoce el código de funciones. Me explico, he probado a ir poniendo cosas.

Si en mi página PHP dejo símplemente ésto, entonces el formulario se pinta bien:

Código PHP:
<HTML>
<HEAD>
 <TITLE>New Document</TITLE>
</HEAD>
<BODY>



<h3>Create Second Life Account</h3>

<form action="<? php print $_SERVER['PHP_SELF']; ?>" method="post">

<table border="0" cellpadding="3" cellspacing="0">
<tr>
  <td>First name:</td>
  <td><input type="text" name="username" size="25" maxlength="31" value="" /></td>
</tr>
<tr>
  <td>Last name:</td>
  <td>
  <select name="last_name_id">
  <?php
  $last_names 
llsd_get(URI_GET_LAST_NAMES);
  foreach (
$last_names as $last_name_id => $name)
  {
      print 
'<option value="'.$last_name_id.'">'.$name.'</option>';
  }
  
?>
  </select>
  </td>
</tr>
<tr>
    <td>Password:</td>
    <td><input type="password" name="password" size="20" value="" /></td>
</tr>
<tr>
    <td>Email:</td>
    <td><input type="text" name="email" size="35" value="" /></td>
</tr>
<tr>
    <td>Date of brith:</td>
    <td>
    <select name="dob_day">
    <?php
    $days 
get_days();
    foreach (
$days as $key => $value) { print '<option value="'.$key.'" '.$selected.'>'.$value.'</option>'; }
    
?>
    </select>

    <select name="dob_month">
    <?php
    $months 
get_months();
    foreach (
$months as $key => $value) { print '<option value="'.$key.'" '.$selected.'>'.$value.'</option>'; }
    
?>
    </select>

    <select name="dob_year">
    <?php
    $years 
get_years();
    foreach (
$years as $key => $value) { print '<option value="'.$key.'" '.$selected.'>'.$value.'</option>'; }
    
?>
    </select>
    </td>
</tr>
<tr>
    <td></td>
    <td><input type="submit" value="Create SL Account" /></td>
</table>

</form>

</BODY>
</HTML>








Sin embargo en cuanto le meto algo más como aquí, ya comienza a pintar código en la página:

Código PHP:
<?

    
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
    if (
is_name_available($_POST['username'], $_POST['last_name_id']))
    {
        
$user = array
        (
            
'username'     => $_POST['username'],
            
'last_name_id' => (int)$_POST['last_name_id'],
            
'email'        => $_POST['email'],
            
'password'     => $_POST['password'],
            
'dob'          => $_POST['dob_year'].'-'.$_POST['dob_month'].'-'.$_POST['dob_day']
        );

        
$result llsd_post(URI_CREATE_USER$user);
        print 
$result['agent_id'];
    }
    else
    {
        print 
'SL name not available.';
    }
}



?>




<HTML>
<HEAD>
 <TITLE>New Document</TITLE>
</HEAD>
<BODY>



<h3>Create Second Life Account</h3>

<form action="<? php print $_SERVER['PHP_SELF']; ?>" method="post">

<table border="0" cellpadding="3" cellspacing="0">
<tr>
  <td>First name:</td>
  <td><input type="text" name="username" size="25" maxlength="31" value="" /></td>
</tr>
<tr>
  <td>Last name:</td>
  <td>
  <select name="last_name_id">
  <?php
  $last_names 
llsd_get(URI_GET_LAST_NAMES);
  foreach (
$last_names as $last_name_id => $name)
  {
      print 
'<option value="'.$last_name_id.'">'.$name.'</option>';
  }
  
?>
  </select>
  </td>
</tr>
<tr>
    <td>Password:</td>
    <td><input type="password" name="password" size="20" value="" /></td>
</tr>
<tr>
    <td>Email:</td>
    <td><input type="text" name="email" size="35" value="" /></td>
</tr>
<tr>
    <td>Date of brith:</td>
    <td>
    <select name="dob_day">
    <?php
    $days 
get_days();
    foreach (
$days as $key => $value) { print '<option value="'.$key.'" '.$selected.'>'.$value.'</option>'; }
    
?>
    </select>

    <select name="dob_month">
    <?php
    $months 
get_months();
    foreach (
$months as $key => $value) { print '<option value="'.$key.'" '.$selected.'>'.$value.'</option>'; }
    
?>
    </select>

    <select name="dob_year">
    <?php
    $years 
get_years();
    foreach (
$years as $key => $value) { print '<option value="'.$key.'" '.$selected.'>'.$value.'</option>'; }
    
?>
    </select>
    </td>
</tr>
<tr>
    <td></td>
    <td><input type="submit" value="Create SL Account" /></td>
</table>

</form>

</BODY>
</HTML>