tengo que reemplazar unos tags con un div que se muestre y oculte segun que imagen se pulse, el codigo que use fue :
Código PHP:
<script>
function mostrar() {
div = document.getElementById("help");
div.style.display = "";
}
function cerrar() {
div = document.getElementById("help");
div.style.display="none";
}
</script>
if (($_POST["firma"]=="") or ($_POST["date"]=="")){
echo "error! must sign the page to continue <b>".$_POST["page"]."</b><br>";
}
else{
include('functions.php');
$date=get_date_today();
//if ($contrato==""){
$contrato=$id;
//}
?>
<form action="?go=evt_contracts" method="post"><?php
//if ($_POST[lstevt]){
//obtengo el contenido del contrato y lo divido en paginas
$sql="select content, event_id from client_contracts as cc
join talents_contracts_signed as tcs on tcs.contract_id=cc.id
where cc.id=$contrato";
/*}
else{
$sql="select content, event_id from client_contracts as cc
join talents_contracts_signed as tcs on tcs.contract_id=cc.id
where cc.id=$event";
}*/
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
//echo $sql;
$original=$row["content"];
$page=explode("#PAGE#",$row["content"]);
$id_event=$row["event_id"];
//obtengo todos los datos del talent
$sql="select first_name, concat(first_name,' ',last_name) as full_name from recruiters
where user_id=$_SESSION[iduser]";
$result=mysql_query($sql);
$talent=mysql_fetch_array($result);
//obtengo todos los datos del eventoa reemplazar
$sql="select e.id, e.description as event_name,event_program_code as epc, et.description as type,
c.company_name as client_name, c.website from events as e
join event_types as et on et.id=e.type_id
join clients as c on c.id=e.client_id
where e.id=$id_event";
//echo $sql."<br>";
$result=mysql_query($sql);
$event=mysql_fetch_array($result);
$patrones[0] = '/#TALENT-FULL-NAME#/';
$patrones[1] = '/#TALENT-FIRST-NAME#/';
$patrones[2] = '/#EVENT-NAME#/';
$patrones[3] = '/#AGENCY-NAME#/';
$patrones[4] = '/#EVENT-TYPE#/';
$patrones[5] = '/#EVENT-PROGRAM-CODE#/';
$patrones[6] = '/#CLIENT#/';
$patrones[7] = '/#HELP-LINK-BEGIN#/';
$patrones[8] = '/#HELP-LINK-END#/';
$reemplazos[0] = $talent["full_name"];
$reemplazos[1] = $talent["first_name"];
$reemplazos[2] = $event["event_name"];
$reemplazos[3] = $event["client_name"];
$reemplazos[4] = $event["type"];
$reemplazos[5] = $event["epc"];
$reemplazos[6] = $event["client_name"];
$reemplazos[7] = '<div id="mostrarDiv"><a href="javascript:mostrar();"><img src="../images/info.png" alt="Help"
title="help"/></a></div><div id="help" style="display:none;">';
$reemplazos[8] = '<a href="javascript:cerrar();"> <img src="../images/close.png" alt="Close Help"
title="close help"/></a> </div>';
//$i=0;
$count=count($page)-1;
$i=$_POST["page"];
$j=$i+1;
$k=$count+1;
echo "</br>page: $j of $k";
//if ($i!=0 and $i==$count){
?>
<div style="background:#FFF none repeat scroll 0%;height:1000px;margin:20px 0pt 0pt 0px;
overflow:auto;position:relative;width:750px; border:1px solid; padding:10px;">
<?php echo preg_replace($patrones, $reemplazos, $page[$i]);
$i=$i+1;?>
</div>
<br/>
<p>I <input type="text" name="firma" value="">have read and completely understand the above stated event information.</p>
<p>Date: <input type="text" name="date" value="<? echo $date;?>" readonly></p>
<?php
if ($i!=0 and $i<=$count){?>
<p><input type="submit" name="next" value="next page"></p>
<input type="hidden" name="page" value="<? echo $i;?>">
<input type="hidden" name="contrato" value="<? echo $contrato;?>"><?php
}
else{?>
<p><input type="submit" name="signed" value="signed contract"></p>
<?php }?>
</form>
<?php
//}
}
Bien mi consulta es hay alguna forma de crear divs con distintos id y que se manejen de forma independiente, es decir dinamicamente con un solo codigo?
espero que se haya entendido y me ayuden porque tengo que solucionarlo urgente desde ya muchas gracias