Ver Mensaje Individual
  #2 (permalink)  
Antiguo 05/11/2011, 06:47
Avatar de crissrocca
crissrocca
 
Fecha de Ingreso: febrero-2011
Mensajes: 51
Antigüedad: 13 años, 8 meses
Puntos: 1
Información Respuesta: formulario con campo incremental a peticion del usuario

formulario.php(1 parte)
[PHP]
<?php
//echo $user_id;
// datos del usuario FROM users
$result = mysql_query("SELECT * FROM users WHERE id = '$user_id'");

// datos del CV FROM CviCvitae - `user_id``computer_capabilities``organization_capa bilities``fax``social_capabilities``other_capabili ties``cvi_cvitaeable_type`
//`technical_capabilities``other_info``artistic_capa bilities``rating`
$queryCviCvitae = mysql_query("SELECT * FROM CviCvitae WHERE user_id = '$user_id'");

// datos Estudios FROM CviEducation - `education_title``center_name``education_capacitie s``education_starts_at``education_ends_at``center_ type`
$queryCviEducation = mysql_query("SELECT * FROM CviEducation WHERE user_id = '$user_id'");

// datos Experiencia FROM CviExperience - `company_sector``company_address``starts_at``funct ions``position``ends_at``company_name`
$queryCviExperience = mysql_query("SELECT * FROM CviExperience WHERE user_id = '$user_id'");

// datos Formacion FROM CviCourse - CviCourse - `course_center``course_hours``course_year``course_ capacities``course_name`
$queryCviCourse = mysql_query("SELECT * FROM CviCourse WHERE user_id = '$user_id'");

// datos Idiomas FROM CviCvitaeLanguage - `language``speaking``reading``talking``writing``li stening`
$queryCviCvitaeLanguage = mysql_query("SELECT * FROM CviCvitaeLanguage WHERE user_id = '$user_id'");

// datos Hobby FROM CviHobby - `hobby_name`
$queryCviHobby = mysql_query("SELECT * FROM CviHobby WHERE user_id = '$user_id'");

$row_CviCvitae = mysql_fetch_array($queryCviCvitae);
$row_CviEducation = mysql_fetch_array($queryCviEducation);
$row_CviExperience = mysql_fetch_array($queryCviExperience);
$row_CviCourse = mysql_fetch_array($queryCviCourse);
$row_CviCvitaeLanguage = mysql_fetch_array($queryCviCvitaeLanguage);
$row_CviHobby = mysql_fetch_array($queryCviHobby);


if ($row = mysql_fetch_array($result)){
echo "<div id='profile_name' ><img style='float: left; padding-right: 15px; padding-top: 2px;' src='wp-content/themes/bowtie/images/icons/black/ID.png' />".$row["first_name"]." ".$row["last_name"]."</div>\n";
} else {
echo "La base de datos esta vacia !";
}


//insertamos los datos del form [$_POST]
if( count( $_POST ) ){
$computer_capabilities = $_POST["computer_capabilities"];
$organization_capabilities = $_POST["organization_capabilities"];
$social_capabilities = $_POST["social_capabilities"];
$other_capabilities = $_POST["other_capabilities"];
$technical_capabilities = $_POST["technical_capabilities"];
$artistic_capabilities = $_POST["artistic_capabilities"];
$other_info = $_POST["other_info"];
//$cvi_cvitaeable_type = $_POST["cvi_cvitaeable_type"];
$education_title = $_POST["education_title"];
$center_name = $_POST["center_name"];
$education_capacities = $_POST["education_capacities"];
$education_starts_at = $_POST["education_starts_at"];
$education_ends_at = $_POST["education_ends_at"];
$center_type = $_POST["center_type"];
$company_sector = $_POST["company_sector"];
$company_address = $_POST["company_address"];
$functions = $_POST["functions"];
$position = $_POST["position"];
$starts_at = $_POST["starts_at"];
$ends_at = $_POST["ends_at"];
$company_name = $_POST["company_name"];
$course_center = $_POST["course_center"];
$course_hours = $_POST["course_hours"];
$course_year = $_POST["course_year"];
$course_capacities = $_POST["course_capacities"];
$course_name = $_POST["course_name"];
$language = $_POST["language"];
$speaking = $_POST["speaking"];
$reading = $_POST["reading"];
$talking = $_POST["talking"];
$writing = $_POST["writing"];
$listening = $_POST["listening"];
$hobby_name = $_POST["hobby_name"];

$user_id = $_POST["user_id"];

echo CviCvitae($computer_capabilities,$organization_cap abilities, $social_capabilities, $other_capabilities, $technical_capabilities, $artistic_capabilities, $other_info, $user_id);
echo CviEducation($education_title, $center_name, $education_capacities, $education_starts_at, $education_ends_at, $center_type, $user_id);
echo CviExperience($company_sector, $company_address, $starts_at, $functions, $position, $ends_at, $company_name, $user_id);
echo CviCourse($course_center, $course_hours, $course_year, $course_capacities, $course_name, $user_id);
echo CviCvitaeLanguage($language, $speaking, $reading, $talking, $writing, $listening, $user_id);
echo CviHobby($hobby_name, $user_id);

//echo CviCVCreate ($computer_capabilities,$organization_capabilities , $social_capabilities, $other_capabilities, $technical_capabilities, $artistic_capabilities, $other_info, $user_id,$education_title, $center_name, $education_capacities, $education_starts_at, $education_ends_at, $center_type, $user_id,$company_sector, $company_address, $starts_at, $functions, $position, $ends_at, $company_name, $user_id,$course_center, $course_hours, $course_year, $course_capacities, $course_name, $user_id,$hobby_name, $user_id,$language, $speaking, $reading, $talking, $writing, $listening, $user_id);

/*echo "<script type='text/javascript'>";
echo "window.alert('Sus datos han sido guardados correctamente');";
echo "location.href='?vista=profile_cv_edit'";
echo "</script>";*/
}

?>
<div id="profile_cv" style="overflow: auto !important; width: 100% !important; height: auto !important" >

<form action="" method="post">
<table width="auto" border="0" style="background: URL('login/img/input.png'); margin-bottom: 20px;" cellpadding="2" cellspacing="2">
<tr>
<td valign="top">
<fieldset>
<legend>Estos son los datos de su Curriculum Vitae</legend>

<!-- ##################################### datos Estudios ##################################### -->
<table id="tablaUsuarios" width="100%" border="0" cellpadding="2" cellspacing="2" style="padding: 15px">
<tr>
<td colspan="2"><span style="border-bottom: 1px solid #ED6D16;">Estudios</span><br/><br/></td>
</tr>
<tr>
<td nowrap="nowrap"><div align="right">Estudios </div>
</td>
<td><input name="education_title" id="education_title" type="text" size="74" value="<?php echo $row_CviEducation["education_title"]; ?>" /></td>
<script type="text/javascript">
var education_title = new LiveValidation('education_title');
education_title.add(Validate.Length, { minimum: 4 } );
education_title.add( Validate.Presence );
</script>
</tr>
<tr>
<td nowrap="nowrap"><div align="right">Titulacion </div></td>
<td><input name="education_capacities" id="education_capacities" type="text" size="74" value="<?php echo $row_CviEducation["education_capacities"]; ?>" /></td>
<script type="text/javascript">
var education_capacities = new LiveValidation('education_capacities');
education_capacities.add(Validate.Length, { minimum: 4 } );
education_capacities.add( Validate.Presence );
</script>
</tr>
<tr>
<td nowrap="nowrap"><div align="right">Centro </div></td>
<td><input name="center_name" id="center_name" type="text" size="74" value="<?php echo $row_CviEducation["center_name"]; ?>" /></td>
<script type="text/javascript">
var title = new LiveValidation('center_name');
center_name.add(Validate.Length, { minimum: 4 } );
center_name.add( Validate.Presence );
</script>
</tr>
<tr>
<td nowrap="nowrap"><div align="right">Tipo de Centro</div></td>
<td><input name="center_type" id="center_type" type="text" size="74" value="<?php echo $row_CviEducation["center_type"]; ?>" /></td>
<script type="text/javascript">
var capacities = new LiveValidation('center_type');
center_type.add(Validate.Length, { minimum: 4 } );
center_type.add( Validate.Presence );
</script>
</tr>
<tr>
<td nowrap="nowrap"><div align="right">Desde el </div></td>
<?php

$starts_at = $row_CviEducation["education_starts_at"];
$starts = array_reverse(explode('-', $starts_at));
$starts_array = array_reverse($starts);
?>
<td><input name="education_starts_at" id="education_starts_at" type="text" size="10" value="<?php print $starts_array[2].'-'.$starts_array[1].'-'.$starts_array[0]; ?>" /></td>
<script type="text/javascript">
var education_starts_at = new LiveValidation('education_starts_at');
education_starts_at.add( Validate.Presence );
education_starts_at.add( Validate.Length, { minimum: 10, maximum: 10 } );
</script>
</tr>
<tr>
<td nowrap="nowrap"><div align="right">hasta el </div></td>
<?php

$ends_at = $row_CviEducation["education_ends_at"];
$ends = array_reverse(explode('-', $ends_at));
$ends_array = array_reverse($ends);
?>
<td><input name="education_ends_at" id="education_ends_at" type="text" size="10" value="<?php print $ends_array[2].'-'.$ends_array[1].'-'.$ends_array[0]; ?>" /></td>
<script type="text/javascript">
var education_ends_at = new LiveValidation('education_ends_at');
education_ends_at.add( Validate.Presence );
education_ends_at.add( Validate.Length, { minimum: 10, maximum: 10 } );
</script>
</tr>
<tr>
<td colspan="2"><input style="float: right; margin-right: 50px;" type="button" onClick="agregarUsuario()" value="A&ntilde;adir" /></td>
</tr>

<!-- ##################################### datos Formacion ##################################### -->
[PHP]