Ver Mensaje Individual
  #4 (permalink)  
Antiguo 10/04/2008, 13:46
Avatar de destor77
destor77
 
Fecha de Ingreso: noviembre-2004
Ubicación: Gálvez, Santa Fe, Argentina
Mensajes: 2.654
Antigüedad: 19 años, 5 meses
Puntos: 43
Re: php + javascript como hacer esto?

richardinj:
mmm no entendi mucho lo que dijiste, estuve mirando algunos ejemplos del foro javascript pero sigo sin hacerlo funcionar, es mas ahora estoy intentando en vez de armar checkbox que me lo tire a una lista de seleccion multiple, pero ninguno de los ejemplo me funca, nose si es porque mi formulario esta dentro de una funcion de mi archivo php, estoy que me vuelvo loco jajaja

pateketrueke algun ejemplo para ver su codigo soy muy verde en javascript y ajax

este es mi codigo:
Código PHP:
include('functions.php');
    if ($_POST['btnnewformevent']){
        form_new_event();
    }
    else{
        if ($_POST['btnnewevent']){
            new_event();
        }
        else{
            if ($_POST['btnmoreform']){
                form_more_retails();
            }
            else{
                if ($_POST['btnmore']){
                    more_retails();
                }
                else{
                    if ($_POST['btnstoreform']){
                    new_store_form();
                    }
                    else{
                        if ($_POST['btnstore']){
                            new_store();
                        }
                        else{
                            if ($_GET['option']=="view"){
                                view_event();
                            }
                            else{
                                if ($_GET['option']=="edit"){
                                    edit_form_event();
                                }
                                else{
                                    if ($_POST['brnedit']){
                                        edit_event();
                                    }
                                    else{
                                        if($_POST['btnlistlocations']){
                                            list_locations();
                                        }
                                        else{
                                            if ($_POST['btnlocations']){
                                                locations();
                                            }
                                            else{
                                                principal();
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }    
                }
            }
        }
    
    }

function principal(){
    $sql="select id, company_name from clients";
    $res=mysql_query($sql);?>
        Select a Client:
        <form action="" method="POST">
            <select name="lstclient" multiple>
                <?php 
                $f
=1;
                while (
$row=mysql_fetch_array($res)){
                    
$f=0;
                    
?>
                    <option value="<? echo $row[id]?>"><? echo $row[id]." - ".$row[company_name];?></option>
          <?php }
                if(
$f){?>
                <option value="0">No clients in database.</option>
                </select>
            <? }else{?>
                </select>
                <input name="btnnewformevent" type="submit" value="Select">
            <? }?>
        </form>    <?php
    $sql
"select clients.company_name, events.id, description, date, client_id from events join clients on clients.id=events.client_id
            where type_id='1'"
;
    
$result=mysql_query($sql);?>
    <br><p>List Events</p>
        <table width="474" border="0" cellpadding="1" cellspacing="1">
          <tr>
            <td width="50" height="19" valign="top" bgcolor="#CCCCCC"><div align="center">Id Event</div></td>
            <td width="214" valign="top" bgcolor="#CCCCCC"><div align="center">Description Event</div></td>
            <td width="80" valign="top" bgcolor="#CCCCCC"><div align="center">Date</div></td>
            <td width="102" valign="top" bgcolor="#CCCCCC"><div align="center">Client</div></td>
            <td width="89" valign="top" bgcolor="#CCCCCC">Actions</td>
          </tr><?php
          
while ($row=mysql_fetch_array($result)){?>
          <tr>
            <td height="21" valign="top"><?php echo $row['id'];?></td>
            <td valign="top"><?php echo $row['description'];?></td>
            <td valign="top"><?php echo $row['date'];?></td>
            <td valign="top"><?php echo $row['company_name'];?></td>
            <td valign="top"><a href="?go=input_event-with&option=view&amp;id_event=<? echo $row['id'];?>">View</a> 
            / <a href="?go=input_event-with&option=edit&amp;id_event=<? echo $row[id];?>">Edit</a></td>
          </tr>
    <?php }?>
        </table><?php
}//fin funcion principal.

function form_new_event(){
    
$id_client=$_POST['lstclient'];
    
$sql="select * from clients left join client_contacts on client_contacts.client_id=clients.id left join client_phones on
             client_phones.client_id=clients.id where clients.id='$id_client'"
;
    
$resul=mysql_query($sql);
        
$row=mysql_fetch_array($resul);?>
        <h3>New Event With Kit</h3><br><br>
        <p>Company Name: <?php echo $row[company_name];?></p>
        <p>Company Phone: <?php echo $row[number];?></p>
        <p>Company Address: <?php echo $row[address];?></p>
        <p>City: <?php echo $row[city];?></p>
        <p>State: <?php echo $row[state];?></p>
        <p>Contact Name: <?php echo $row[contact_name];?></p>
        <p>Contact phone: <?php echo $row[phone_number];?></p>
        <p>Contact Email: <?php echo $row[email];?></p>
        <br>
        Data Event:<br>
        <?php $id_store=$_POST['lstretails']; ?>
        <form name="frm" action="<?php $_SERVER['PHP_SELF'];?>" method="POST">
            <input type="hidden" name="id_client" value="<? echo $id_client;?>">
            <p>Primary Objetive: <input type="text" name="objective" value=""></p>
            <p>Position Title: <input type="text" name="title" value=""></p>
            <p>Event Program Code: <input type="text" name="programcode" value=""></p>
            <p>Event Description:</p> 
            <p><textarea name="description"></textarea></p><br><br><br><br>                
            <p>Event Date: <input type="text" name="eventdate" value="yyyy-mm-dd"></p>
            <p>Start Time: <input type="text" name="startime" value="H:m"></p>
            <p>End Time: <input type="text" name="endtime" value="H:m"></p>
            <p>Event Rate: <input type="text" name="eventrate" value=""></p>
            <p>Total Event Income: <input type="text" name="eventincome"></p>
            <br>
            <p>Retail Store/s:
                <select name="lstretails" onchange="document.frm.submit()">
                <option></option>
            <?php $sql="select id_store, name from stores";
                  
$result=mysql_query($sql);
                  
$f=1;
                  while (
$row=mysql_fetch_array($result)){
                      
$f=0;
                      
?>
                      <option value="<? echo $row[id_store]?>"><? echo $row[name];?></option>
            <?php }
                if(
$f){?>
                <option value="0">No users in database.</option>
                </select>
                <input type="submit" name="btnstoreform" value="New Store">
          <?php }else{?>
                </select>
                <input type="submit" name="btnstoreform" value="New Store">
            <?php }?>
            <p class="required">EID: <input type="text" name="eid" value=""></p>
            <p>Unique Store Number: <input type="text" name="unique" value=""></p>
    <input name="btnnewevent" type="submit" value="submit">
        </form>
    <?
}// fin funcion fomr_new_event.

function new_event(){
    
//seteo todas las variables para no usar el $_POST
    
$id_cliente=$_POST['id_client'];
    
$objetive=$_POST['objective'];
    
$title=$_POST['title'];
    
$programcode=$_POST['programcode'];
    
$description=$_POST['description'];
    
$evendate=$_POST['eventdate'];
    
$starttime=$_POST['startime'];
    
$endtime=$_POST['endtime'];
    
$eventrate=$_POST['eventrate'];
    
$eventincome=$_POST['eventincome'];
    
$eid=$_POST['eid'];
    
$unique=$_POST['unique'];
    
$id_store=$_POST['lstretails'];
    
$address=$_POST['address'];
    
$state=$_POST['cmbstate'];
    
$city=$_POST['city'];
    
$zip=$_POST['zip'];
    
$phone=$_POST['phone'];
    
$quantity=$_POST['quantity'];
    
$newreatil=$_POST['newreatil'];
    
$rateagency=$_POST['rateagency'];
    
$incomeagency=$_POST['incomeagency'];
    
$clientincentive=$_POST['clientincentive'];
    
$book25=$_POST['boock25'];
    
$book50=$_POST['boock50'];
    
$book75=$_POST['boock75'];
    
$book100=$_POST['boock100'];
    
$target=$_POST['target'];
    
$supplies=$_POST['supplies'];
    
$training=$_POST['training'];
    
$agerangetop=$_POST['agerangetop'];
    
$agerangebottom=$_POST['agerangebottom'];
    
$experience=$_POST['experience'];
    
$male=$_POST['male'];
    
$famale=$_POST['famale'];
    
$model=$_POST['model'];
    
$misc1=$_POST['misc1'];
    
$misc2=$_POST['misc2'];
    
$error="";

.......
salu2

Última edición por destor77; 10/04/2008 a las 14:01