Jump to content
Fórum Script Brasil
  • 0

Str_repleace


Eric Freitas
 Share

Question

bom pessoal to com um probleminha e num intendi o porque. vou postar meu código pra v6 analizarem..

$_procura = array('Pergunta Chave','Resposta Chave');
    $_troca = array('pergunta','resposta');
    $_i=0;
    foreach($_dados as $_chv => $_vlr){
        if(($_chv =='Pergunta Chave') || ($_chv=='Resposta Chave')){
            echo'<tr>
                      <td><strong>'.$_chv.'</strong></td>
                      <td><img src="imagens/flexa_cad.gif" width="15" height="20"></td>';
              foreach($_procura as $_chv ){
                  $_chv = str_repleace($_procura[$_i],$_troca[$_i],$_chv); //linha do erro
                  $_i++;
                  echo'<td><input name="'.$_chv.'" type="text" id="'.$_chv.'" size="25" maxlength="50"></td>
                     </tr>';
              }

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

ok arrumei isso

o código fico beleza e ele funciona.. mas. não intendi porque ele só troca o Resposta Chave por resposta e o pergunta chave ele troca por resposta chave.

segue abaixo o código pra v6 analizarem...

$_procura = array('Pergunta Chave','Resposta Chave');
    $_troca = array('pergunta','resposta');
    $_i=0;
    foreach($_dados as $_chv => $_vlr){
        if(($_chv =='Pergunta Chave') || ($_chv=='Resposta Chave')){
            echo'<tr><td colspan="3"><font color="red">O campo '.$_chv.' deve estar preenchido.</font></td></tr>';
            echo'<tr>
                      <td><strong>'.$_chv.' :</strong></td>
                      <td><img src="imagens/flexa_cad.gif" width="15" height="20"></td>';
              foreach( $_procura as $_chv ){
                  $_chv = str_replace($_procura[$_i],$_troca[$_i],$_chv);
              }
              echo'<td><input name="'.$_chv.'" type="text" id="'.$_chv.'" size="25" maxlength="50"></td>
                     </tr>';
              $_i+=1;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.2k
    • Total Posts
      647.4k
×
×
  • Create New...