
Bonjour,
voilà je n'ai que quelques connaissances en php,
j'ai récupéré un script immobilier qui contient un formulaire avec juste un onglet pour choisir la catégorie puis un bouton de validation qui lui affiche un deuxième formulaire plus avancé.
mon problème c'est que le deuxième formulaire je voudrais qu'il s'affiche en même temps que le premier.
( question d' esthetique),
voilà le script php dans la page:merci<table class="formRechAvancee" width="100%">
<tr><th>Recherche avancée - Catégorie : <?php echo $cat->nom; ?></th></tr>
<tr><td>
<form name="formRechercheAvancee" action="<?php echo $phpSelf; ?>" method="POST">
<input type="hidden" name="formRechercheAvancee" value="1">
<?php
$ra->afficheFormulaire();
?>
</form>
</td></tr>
</table>
et voici la classe:<?php
class RechAvancee {
var $id_categorie;
var $id_types = array();
var $id_attributs = array();
var $id_villes = array();
var $auxEnvirons = false;
var $id_attributsVille = array();
var $listeBiens = array();
function RechAvancee() {
}
function afficheFormulaire() {
$listeIdNomTypes = Type::listeIdNomTypes($this->id_categorie);
$listeIdNomAttributs = Attribut::listeIdNomAttributs($this->id_categorie,true);
if(strtolower(get_class($this))=="alertemail") {
$nomFormulaire = 'formAlerteMail';
} else {
$nomFormulaire = 'formRechercheAvancee';
}
?>
<input type="hidden" name="id_categorie" value="<?php echo $this->id_categorie; ?>">
<table width="100%" class="formRechAvanceeAttributs">
<?php
if(!empty($listeIdNomTypes)) {
?><tr><th colspan=2 bgcolor="#ff0000">Types</th></tr>
<tr><td colspan=2 nowrap>Choisissez au moins un type.   
<input type="button" style="font-size:90%" value="tous"
onclick="<?php
$html = '';
foreach($listeIdNomTypes as $k=>$v) {
echo 'document.'.$nomFormulaire.'.idType_'.$k.'.checked=true;';
$html .= '<input type="checkbox" name="idType_'.$k.'" '
.(in_array($k,$this->id_types)?'checked':'')
.' id="idType_'.$k.'"><label for="idType_'.$k.'">'.$v.'</label>    ';
}
?>"><br><?php echo $html; ?><br>
</td></tr>
<?php
}
?>
<tr><th colspan=2>Attributs</th></tr>
<tr><td colspan=2>Laisser ces champs vides si indifférent.</td></tr>
<tr><td width="50%" nowrap>
<?php
$html = '';
$i=0;
foreach($listeIdNomAttributs as $k=>$v) {
$html .= '<table class="vide" width="100%" border=0><tr><td>';
if($v[2]==TYPE_BOOLEEN) {
$html .= $v[0].' :</td><td align="right"><select name="idAttribut_'.$k.'">'
.'<option value="indifferent">Indifférent</option>'
.'<option value="1" '
.((array_key_exists($k,$this->id_attributs) && $this->id_attributs[$k]==1)?'selected':'')
.'>Oui</option>'
.'<option value="0" '
.((array_key_exists($k,$this->id_attributs) && $this->id_attributs[$k]==0)?'selected':'')
.'>Non</option>'
.'</select>';
}
elseif($v[2]==TYPE_NOMBRE) {
$mini = null;
$maxi = null;
if(array_key_exists($k,$this->id_attributs)) {
list($mini,$maxi) = explode(":",$this->id_attributs[$k]);
}
$html .= $v[0].' :</td><td align="right">mini '
.'<input size="10" type="text" style="font-size:90%" name="idAttribut_'.$k.'_mini" '
.(is_null($mini)?'':'value="'.$mini.'"').'>'
.' maxi <input size="10" type="text" style="font-size:90%" name="idAttribut_'.$k.'_maxi" '
.(is_null($maxi)?'':'value="'.$maxi.'"').'>';
}
elseif($v[2]==TYPE_TEXTE && strtolower(get_class($this))!="alertemail") {
$html .= $v[0].' :</td><td align="right"><input type="text" style="font-size:90%" name="idAttribut_'.$k.'" size=20 maxlength=100'
.(array_key_exists($k,$this->id_attributs)?' value="'.$this->id_attributs[$k].'"':'').'>';
}
$html .= '</td></tr></table>';
$i++;
if($i==intval((1+sizeof($listeIdNomAttributs))/2)) {
$html .= '</td><td width="50%" nowrap valign=top>';
}
}
echo $html;
?>
</td></tr>
<tr><th valign="top" colspan=2>Localités</th></tr>
<tr><td valign="top" colspan=2>Si vous ne sélectionnez aucune ville, la recherche se fera sur toutes les localités.<br>
<?php
if(strtolower(get_class($this))!="alertemail") {
echo '<input type="checkbox" name="auxEnvirons" id="auxEnvirons"'.($this->auxEnvirons?' checked':'')
.'><label for="auxEnvirons">Rechercher aussi aux alentours des villes sélectionnées.</label><br>';
}
$listeIdNomVilles = Ville::listeIdNomVilles();
foreach($listeIdNomVilles as $k=>$v) {
echo '<input type="checkbox" name="idVille_'.$k.'" '
.'id="idVille_'.$k.'" '
.(in_array($k,$this->id_villes)?'checked':'')
.'><label for="idVille_'.$k.'">'.$v.'</label>  ';
}
?>
</td></tr>
<?php
if(strtolower(get_class($this))!="alertemail") {
?>
<tr><th colspan=2 bgcolor="#ff0000">Services sur place ou à proximité</th></tr>
<tr><td colspan=2>Laisser ces champs vides si indifférent.</td></tr>
<tr><td width="50%" nowrap>
<?php
$listeIdNomAttrVille = AttrVille::listeIdNomAttrVille();
$html = '';
$i=0;
foreach($listeIdNomAttrVille as $k=>$v) {
$html .= '<input type="checkbox" id="idAttrVille_'.$k.'" name="idAttrVille_'.$k.'"'
.(in_array($k,$this->id_attributsVille)?' checked':'').'>'
.'<label for="idAttrVille_'.$k.'"> '.$v[0].'</label>';
$i++;
if($i==intval((1+sizeof($listeIdNomAttrVille))/2)) {
$html .= '</td><td width="50%" nowrap valign="top">';
} else {
$html .= '<br>';
}
}
echo $html;
?>
</td></tr>
</table>
<p align="center"><input type="button" value="Rechercher" onclick="<?php
if(!empty($listeIdNomTypes)) {
echo 'if(true';
foreach($listeIdNomTypes as $k=>$v) {
echo ' && document.'.$nomFormulaire.'.idType_'.$k.'.checked==false';
}
echo ') alert(\'Sélectionnez au moins un type\'); '
.'else document.'.$nomFormulaire.'.submit();';
} else {
echo 'document.'.$nomFormulaire.'.submit();';
}
?>"></p>