• User

    Questo e' il codice:
    function show_search_form($select = 'filename') {
    global $grants, $user_status, $font, $bordercolor, $headercolor, $classa,$classb,$backimg, $tablecolor, $mess, $phpExt, $q, $headerfontcolor;

    echo " <table summary="" border="0" width="950" bgcolor="$bordercolor" cellpadding="4" cellspacing="1">
    <tr>
    <th align="left" class="$classa" bgcolor="$headercolor" valign="middle">
    <font size="2" face="$font" color="$headerfontcolor"><b>$mess[224]</b></font></font>
    </th>
    </tr>
    <td align="left" class="$classb" bgcolor="$tablecolor" valign="middle">
    <font size="1" color="$normalfontcolor" face="$font">
    <form action="search.${phpExt}?".SID."" method="post" style="margin: 0">
    <input type="text" name="q" value="$q" class="vform" size=25> Ricerca Per:
    <select name="action" class="vform">";
    if($select == 'filename')
    echo "
    <option value="showsearchresults_byfilename" selected>Cognome</option>
    <option value="showsearchresults_byall">Per nome</option>";

         else 
            echo " 
            <option value=\"showsearchresults_byfilename\">Cognome</option> 
            <option value=\"showsearchresults_byall\" selected>Per nome</option>"; 
         echo " 
         </select> 
      <input class=\"vform\" type=\"submit\" value=\"Cerca\" > 
            </form><br> 
            <table summary=\"\" border=\"0\" width=\"90%\" bgcolor=\"$bordercolor\" cellpadding=\"4\" cellspacing=\"1\"> 
       
           
            <font size=\"1\" color=\"$normalfontcolor\" face=\"$font\"> 
            </td> 
             
      </tr> 
      </table> 
     <br>"; 
    

    }

    devo solo inserire un alert in php,no javascript,possibilmente che se uno fa la ricerca senza inserire neppure una parola ,non viene accettata e appare la scritta inserisci almeno una parola!

    tipo questo:

    function controllo()
    {
    if (document.nomeform.nomecampo.value=="")
    {
    alert("Campo vuoto!")
    return(false)
    }

    }

    ....pero la mia ignoranza non mi permettedi farlo!!
    Grazie ancora!!


  • ModSenior

    Allora php non centra nulla, il controllo è sempre javascript.
    [php]
    function show_search_form($select = 'filename') {
    global $grants, $user_status, $font, $bordercolor, $headercolor, $classa,$classb,$backimg, $tablecolor, $mess, $phpExt, $q, $headerfontcolor;

    echo " <table summary=\"\" border=\"0\" width=\"950\" bgcolor=\"$bordercolor\" cellpadding=\"4\" cellspacing=\"1\"> 
      <tr> 
        <th align=\"left\" class=\"$classa\" bgcolor=\"$headercolor\" valign=\"middle\"> 
    

    <font size="2" face="$font" color="$headerfontcolor"><b>$mess[224]</b></font></font>
    </th>
    </tr>
    <td align="left" class="$classb" bgcolor="$tablecolor" valign="middle">
    <font size="1" color="$normalfontcolor" face="$font">
    <form action="search.${phpExt}?".SID."" method="post" style="margin: 0">
    <input type="text" name="q" value="$q" class="vform" size="25" onblur="if(this.value==""){alert('Inserisci almeno una parola');(this.value='Default';}"> Ricerca Per:
    <select name="action" class="vform">";
    if($select == 'filename')
    echo "
    <option value="showsearchresults_byfilename" selected>Cognome</option>
    <option value="showsearchresults_byall">Per nome</option>";

         else 
            echo " 
            <option value=\"showsearchresults_byfilename\">Cognome</option> 
            <option value=\"showsearchresults_byall\" selected>Per nome</option>"; 
         echo " 
         </select> 
      <input class=\"vform\" type=\"submit\" value=\"Cerca\" > 
            </form><br> 
            <table summary=\"\" border=\"0\" width=\"90%\" bgcolor=\"$bordercolor\" cellpadding=\"4\" cellspacing=\"1\"> 
       
           
            <font size=\"1\" color=\"$normalfontcolor\" face=\"$font\"> 
            </td> 
             
      </tr> 
      </table> 
     <br>"; 
    

    }
    [/php]


  • User

    Grazie ,ho provato ma mi da errore !!!
    c'e' qualche variante!


  • ModSenior

    Ho scordato 2 blackslash, prova cosi:
    [php]
    function show_search_form($select = 'filename') {
    global $grants, $user_status, $font, $bordercolor, $headercolor, $classa,$classb,$backimg, $tablecolor, $mess, $phpExt, $q, $headerfontcolor;

    echo " <table summary=\"\" border=\"0\" width=\"950\" bgcolor=\"$bordercolor\" cellpadding=\"4\" cellspacing=\"1\"> 
      <tr> 
        <th align=\"left\" class=\"$classa\" bgcolor=\"$headercolor\" valign=\"middle\"> 
    

    <font size="2" face="$font" color="$headerfontcolor"><b>$mess[224]</b></font></font>
    </th>
    </tr>
    <td align="left" class="$classb" bgcolor="$tablecolor" valign="middle">
    <font size="1" color="$normalfontcolor" face="$font">
    <form action="search.${phpExt}?".SID."" method="post" style="margin: 0">
    <input type="text" name="q" value="$q" class="vform" size="25" onblur="if(this.value==""){alert('Inserisci almeno una parola');(this.value='Default';}"> Ricerca Per:
    <select name="action" class="vform">";
    if($select == 'filename')
    echo "
    <option value="showsearchresults_byfilename" selected>Cognome</option>
    <option value="showsearchresults_byall">Per nome</option>";

         else 
            echo " 
            <option value=\"showsearchresults_byfilename\">Cognome</option> 
            <option value=\"showsearchresults_byall\" selected>Per nome</option>"; 
         echo " 
         </select> 
      <input class=\"vform\" type=\"submit\" value=\"Cerca\" > 
            </form><br> 
            <table summary=\"\" border=\"0\" width=\"90%\" bgcolor=\"$bordercolor\" cellpadding=\"4\" cellspacing=\"1\"> 
       
           
            <font size=\"1\" color=\"$normalfontcolor\" face=\"$font\"> 
            </td> 
             
      </tr> 
      </table> 
     <br>"; 
    

    }
    [/php]

    In caso di errori, incollali sempre per intero in modo da poterli individuare facilmente.


  • User

    e' in questa riga qui:*<select name="action" class="vform">"; *

    <td align="left" class="$classb" bgcolor="$tablecolor" valign="middle">
    <font size="1" color="$normalfontcolor" face="$font">
    <form action="search.${phpExt}?".SID."" method="post" style="margin: 0">
    <input type="text" name="q" value="$q" class="vform" size="25" onblur="if(this.value==""){alert('Inserisci almeno una parola');(this.value='Default';}"> Ricerca Per:
    *<select name="action" class="vform">"; *
    if($select == 'filename')
    echo "


  • User

    @alver said:

    [***]

    Aspetta che provo ,non avevo visto la reply!!
    Mi sembra quasi una chat!
    Grazie


  • ModSenior

    Nel copia incolla sono scomparsi 2 backslash... :mmm:
    [php]
    function show_search_form($select = 'filename') {
    global $grants, $user_status, $font, $bordercolor, $headercolor, $classa,$classb,$backimg, $tablecolor, $mess, $phpExt, $q, $headerfontcolor;

    echo " <table summary=\"\" border=\"0\" width=\"950\" bgcolor=\"$bordercolor\" cellpadding=\"4\" cellspacing=\"1\"> 
      <tr> 
        <th align=\"left\" class=\"$classa\" bgcolor=\"$headercolor\" valign=\"middle\"> 
    

    <font size="2" face="$font" color="$headerfontcolor"><b>$mess[224]</b></font></font>
    </th>
    </tr>
    <td align="left" class="$classb" bgcolor="$tablecolor" valign="middle">
    <font size="1" color="$normalfontcolor" face="$font">
    <form action="search.${phpExt}?".SID."" method="post" style="margin: 0">
    <input type="text" name="q" value="$q" class="vform" size="25" onblur="if(this.value==""){alert('Inserisci almeno una parola');(this.value='Default';}"> Ricerca Per:
    <select name="action" class="vform">";
    if($select == 'filename')
    echo "
    <option value="showsearchresults_byfilename" selected>Cognome</option>
    <option value="showsearchresults_byall">Per nome</option>";

         else 
            echo " 
            <option value=\"showsearchresults_byfilename\">Cognome</option> 
            <option value=\"showsearchresults_byall\" selected>Per nome</option>"; 
         echo " 
         </select> 
      <input class=\"vform\" type=\"submit\" value=\"Cerca\" > 
            </form><br> 
            <table summary=\"\" border=\"0\" width=\"90%\" bgcolor=\"$bordercolor\" cellpadding=\"4\" cellspacing=\"1\"> 
       
           
            <font size=\"1\" color=\"$normalfontcolor\" face=\"$font\"> 
            </td> 
             
      </tr> 
      </table> 
     <br>"; 
    

    }
    [/php]


  • User

    @alver said:

    e' in questa riga qui:*<select name="action" class="vform">"; *

    <td align="left" class="$classb" bgcolor="$tablecolor" valign="middle">
    <font size="1" color="$normalfontcolor" face="$font">
    <form action="search.${phpExt}?".SID."" method="post" style="margin: 0">
    <input type="text" name="q" value="$q" class="vform" size="25" onblur="if(this.value==""){alert('Inserisci almeno una parola');(this.value='Default';}"> Ricerca Per:
    *<select name="action" class="vform">"; *
    if($select == 'filename')
    echo "

    Niente c'e' qualche punto e virgola o slash di troppo!!
    Penso!


  • ModSenior

    Niente oggi è giornata, devo accoggermi degli " poco a poco. :giggle:
    Forse questa è la volta buona. 😄

    [php]
    function show_search_form($select = 'filename') {
    global $grants, $user_status, $font, $bordercolor, $headercolor, $classa,$classb,$backimg, $tablecolor, $mess, $phpExt, $q, $headerfontcolor;

    echo " <table summary=\"\" border=\"0\" width=\"950\" bgcolor=\"$bordercolor\" cellpadding=\"4\" cellspacing=\"1\"> 
      <tr> 
        <th align=\"left\" class=\"$classa\" bgcolor=\"$headercolor\" valign=\"middle\"> 
    

    <font size="2" face="$font" color="$headerfontcolor"><b>$mess[224]</b></font></font>
    </th>
    </tr>
    <td align="left" class="$classb" bgcolor="$tablecolor" valign="middle">
    <font size="1" color="$normalfontcolor" face="$font">
    <form action="search.${phpExt}?".SID."" method="post" style="margin: 0">
    <input type="text" name="q" value="$q" class="vform" size="25" onblur="if(this.value==""){alert('Inserisci almeno una parola');(this.value='Default';}"> Ricerca Per:
    <select name="action" class="vform">";
    if($select == 'filename')
    echo "
    <option value="showsearchresults_byfilename" selected>Cognome</option>
    <option value="showsearchresults_byall">Per nome</option>";

         else 
            echo " 
            <option value=\"showsearchresults_byfilename\">Cognome</option> 
            <option value=\"showsearchresults_byall\" selected>Per nome</option>"; 
         echo " 
         </select> 
      <input class=\"vform\" type=\"submit\" value=\"Cerca\" > 
            </form><br> 
            <table summary=\"\" border=\"0\" width=\"90%\" bgcolor=\"$bordercolor\" cellpadding=\"4\" cellspacing=\"1\"> 
       
           
            <font size=\"1\" color=\"$normalfontcolor\" face=\"$font\"> 
            </td> 
             
      </tr> 
      </table> 
     <br>"; 
    

    }
    [/php]


  • User

    Adesso non mi da piu l'errore ma non mi da l'allert!!