Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it L'avatar di medorex
    Registrato dal
    Apr 2002
    Messaggi
    252

    [php] controlli sui pulsanti

    Ciao a tutti
    ho un form nel quale, tra le altre cose metto la possibiltà di caricare foto.
    Ho in piu uno script che controlla i parametri delle foto.
    Nel form ci sono 4 pulsanti: aggiorna record, crea nuovo record, elimina record e annulla.
    Ecco... come kakkio faccio a dire allo script che controlli solo se si premono i primi due pulsanti e non gli altri due? ?
    vi posto una parte della pagina che tutto non ci stà...
    codice:
    <?php require_once('../Connections/schede.php'); ?>
    ...
    // controllo foto
    if (isset($HTTP_GET_VARS['GP_upload'])) {
    	$ppu = new pureFileUpload();
    	$ppu->path = "../public/foto";
    	$ppu->extensions = "GIF,JPG,JPEG,BMP,PNG";
    	$ppu->formName = "Nxt_tNG";
    	$ppu->storeType = "file";
    	$ppu->sizeLimit = "500";
    	$ppu->nameConflict = "uniq";
    	$ppu->requireUpload = "true";
    	$ppu->minWidth = "0";
    	$ppu->minHeight = "0";
    	$ppu->maxWidth = "370";
    	$ppu->maxHeight = "470";
    	$ppu->saveWidth = "";
    	$ppu->saveHeight = "";
    	$ppu->timeout = "600";
    	$ppu->progressBar = "blueFlashProgress.htm";
    	$ppu->progressWidth = "300";
    	$ppu->progressHeight = "100";
    	$ppu->checkVersion("2.1.2");
    	$ppu->doUpload();
    }
    $GP_uploadAction = $HTTP_SERVER_VARS['PHP_SELF'];
    if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
      if (!eregi("GP_upload=true", $HTTP_SERVER_VARS['QUERY_STRING'])) {
    		$GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING']."&GP_upload=true";
    	} else {
    		$GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING'];
    	}
    } else {
      $GP_uploadAction .= "?"."GP_upload=true";
    }
    ...
    ?>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Form</title>
    <link rel="stylesheet" href="../includes/styles/styles.css" type="text/css">
    <script language='javascript' src='../Script/Upload.js'></script>
    </head>
    <body>
    <div><div>
      <p class="nxttitle">Form</p>
    </div>
    <div class="nxterror">
      <?php
    if ($Nxt_tNG_Insert->getErrorNo()) {
    ?>
      <?php  
      echo $Nxt_tNG_Insert->getErrorMsg(); 
    ?>
      <?php
    } // end Display Error
    ?>
      <?php
    if ($Nxt_tNG_Update->getErrorNo()) {
    ?>
      <?php  
      echo $Nxt_tNG_Update->getErrorMsg(); 
    ?>
      <?php
    } // end Display Error
    ?>
      <?php
    if ($Nxt_tNG_Delete->getErrorNo()) {
    ?>
      <?php  
      echo $Nxt_tNG_Delete->getErrorMsg(); 
    ?>
      <?php
    } // end Display Error
    ?>
    </div>
    
    
    <form action="<?php echo $GP_uploadAction; ?>" method="post" enctype="multipart/form-data" name="Nxt_tNG" onSubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',true,500,0,0,370,470,'','');showProgressWindow('blueFlashProgress.htm',300,100);return document.MM_returnValue">
      <table border="0" cellpadding="2" cellspacing="0" class="nxttable" id="Nxt_tNG" >
        <tr valign="baseline">
          <td nowrap align="right" class="nxtthl">Nome:</td>
          <td class="nxttd"><input type="text" name="nome" value="<?php echo htmlentities($row_singolo['nome']); ?>" size="32" maxlength="50">
          </td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right" class="nxtthl">Il_la:</td>
          <td class="nxttd"><select name="il_la">
            <option value="il" <?php if (!(strcmp("il", htmlentities($row_singolo['il_la'])))) {echo "SELECTED";} ?> selected>il</option>
            <option value="lo" <?php if (!(strcmp("lo", htmlentities($row_singolo['il_la'])))) {echo "SELECTED";} ?>>lo</option>
            <option value="la" <?php if (!(strcmp("la", htmlentities($row_singolo['il_la'])))) {echo "SELECTED";} ?>>la</option>
            <option value="l'" <?php if (!(strcmp("l\'", htmlentities($row_singolo['il_la'])))) {echo "SELECTED";} ?>>l'</option>
            </select>
          </td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right" class="nxtthl">Razza:</td>
          <td class="nxttd"><select name="razza" id="razza">
            <?php
    do {  
    ?>
            <option value="<?php echo $row_Recordset1['tipo']?>"<?php if (!(strcmp($row_Recordset1['tipo'], $row_singolo['razza']))) {echo "SELECTED";} ?>><?php echo $row_Recordset1['tipo']?></option>
            <?php
    } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
      $rows = mysql_num_rows($Recordset1);
      if($rows > 0) {
          mysql_data_seek($Recordset1, 0);
    	  $row_Recordset1 = mysql_fetch_assoc($Recordset1);
      }
    ?>
            </select>
          </td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right" class="nxtthl">Proprietario:</td>
          <td class="nxttd"><input type="text" name="proprietario" value="<?php echo htmlentities($row_singolo['proprietario']); ?>" size="32" maxlength="50">
          </td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right" class="nxtthl">Data:</td>
          <td class="nxttd"><input type="text" name="data" value="<?php echo htmlentities($row_singolo['data']); ?>" size="32" maxlength="50">
          </td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right" class="nxtthl">Dedica:</td>
          <td class="nxttd"><input type="text" name="dedica" value="<?php echo htmlentities($row_singolo['dedica']); ?>" size="32" maxlength="50">
          </td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right" class="nxtthl">Committente:</td>
          <td class="nxttd"><input type="text" name="committente" value="<?php echo htmlentities($row_singolo['committente']); ?>" size="32" maxlength="50">
          </td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right" class="nxtthl">Foto:</td>
          <td class="nxttd"><input name="foto" type="file" onChange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',true,500,0,0,370,470,'','')">
          </td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right" class="nxtthl">Desc_specie:</td>
          <td class="nxttd"><input subtype="n1dependentDropdown" name="desc_specie" type="widget" id="desc_specie" value="<?php echo htmlentities($row_singolo['desc_specie']); ?>" size="32" maxlength="50" readonly="true" boundto="razza" recordset="Recordset2" triggerrs="Recordset1" tpkey="tipo" tfkey="tipo" pkey="tipo" display="descrizione">
          </td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right" class="nxtthl">Desc_specifica:</td>
          <td class="nxttd"><input type="text" name="desc_specifica" value="<?php echo htmlentities($row_singolo['desc_specifica']); ?>" size="32" maxlength="50">
          </td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right" class="nxtthl">Falconiere:</td>
          <td class="nxttd"><input type="text" name="falconiere" value="<?php echo htmlentities($row_singolo['falconiere']); ?>" size="32" maxlength="50">
          </td>
        </tr>
        <tr valign="baseline">
          <td nowrap colspan="2" align="right" class="nxttd"><?php
    							//show if NeXTensio Insert
    							if (!(isset($_GET['id']))) {
    						?>
              <input type="submit" name="MM_insert" value="<?php echo $KT_language['insert'];?>" class="nxtbutton">
              <?php
    								}
    							//end show if NeXTensio Insert
    						?>
              <?php
    							//show if NeXTensio Update
    							if ((isset($_GET['id']))) {
    						?>
              <input type="submit" name="MM_update" value="<?php echo $KT_language['update'];?>" class="nxtbutton">
              <script>
    							function removeId(o) {
    								var tmp = window.location + '';
    								var pk = 'id';
    								var re = new RegExp('(\\?|&)' + pk + '=[^=]*(&|$)', '');
    								tmp = tmp.replace(re, '$1');
    								tmp = tmp.replace(/\?$/, '');
    								o.form.action = tmp;
    							}
    						</script>
              <input type="submit" name="MM_insert" value="<?php echo $KT_language['insertasnew'];?>" class="nxtbutton" onclick="removeId(this)">
              <input type="submit" name="MM_delete" value="<?php echo $KT_language['delete'];?>" onclick="return confirm('<?php echo $KT_language['confirmdelete'];?>');" class="nxtbutton">
              <?php
    								}
    							//end show if NeXTensio Update
    						?>
              <input type="submit" name="MM_cancel" value="<?php echo $KT_language['cancel'];?>" onClick="document.forms.Nxt_tNG.action='../includes/nextensio2/back.php'" class="nxtbutton">
          </td>
        </tr>
      </table>
      <input type="hidden" name="id" value="<?php echo (isset($_GET['id']) ? $_GET['id'] : null ) ?>">
      </p>
    </form>
    </div>
    </body>
    </html>
    <?php
      require_once("../includes/widgets/widgets_end.php");
    ?>
    <?php
    @mysql_free_result($singolo);
    
    mysql_free_result($Recordset1);
    
    mysql_free_result($Recordset2);
    ?>
    Avete idee?
    grazie
    medo
    Ma quando impareremo mai ??

  2. #2
    ma chi si legge tutto questo codice...

  3. #3
    Utente di HTML.it L'avatar di medorex
    Registrato dal
    Apr 2002
    Messaggi
    252

    ??

    niente di piu costruttivo?
    Ma quando impareremo mai ??

  4. #4
    bah.. io di certo non l'ho letto...

    ma quando fai un pulsante questo ha cmq un valore e un nome e cliccando su quel pulsante via POST/GET viene inviatoil valore contenutoin una viariabile col nome del pulsante.. coem se fosse un campo testo.. su questo puoi fare i controlli per vedere quale pulsante è stato schiacciato..

    e vedi di postare solo il codice "interessante" la prox volta che nessuno ha mai voglia di leggere più di 15 righe ^__^


    ..IcE..
    visit the BEST italian fotolog http://www.ghiacciato.it/fotolog

    "Solo due cose sono infinite, l'universo e la stupidità dell'essere umano.. ma sulla prima ho ancora delle riserve.." A.Einstein

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.