Jump to content

RLAArtistry

Members
  • Posts

    31
  • Joined

  • Last visited

Posts posted by RLAArtistry

  1. I have successfully clean up my database and removed all PHP coding from it. Now I have another problem. I am trying to create a script that will show the percentage of satisfied customers from the survey I posted earlier. There is one question in the survey that is really significant to this and it is question number 3 (Q3). The answers for Q3 have values 1-5, where 1 & 2 = satisfied and 3-5 = dissatisfied.

     

    I want to use the sum of the amount of satisfied values (satvalue1 & 2);  divide it by the number of participants (NOP) then multiply by 100 to get the percentage. So far I got the number of rows for the NOP but cant get the correct value for Q3.

     

    $nop = "";
    $Q3 = "";
    $satvalue1 = "1";
    $satvalue2 = "2";
    $TotalsatValue = ($satvalue1) && ($satvalue2);
    $sqlCommand = "SELECT NOP FROM survey1"; 
    $value = mysqli_query($myConnection, $sqlCommand) or die (mysqli_error()); 
    $satvalueTotal = mysqli_num_rows($value);
    $nopvalueTotal = mysqli_num_rows($value);
    $ratings = ($satvalueTotal/$nopvalueTotal)*100;
    echo "$ratings%";
    mysqli_free_result($value); 
    

     

    I'll appreciate any help.

    Thank you

  2. I'm sorry guys but I'm totally blond right now... I totally get keeping it simple and believe it or not, that was what I was trying to accomplish. I was hoping to have 1 file (index.php) and use the database to fill it instead of 20-30 files.

     

    I tried using include() but  I keep getting an error saying it cannot find the file, when I put in the full URL it give me a security error. The includes I have on the main site (rlaartistry.com) work ok, but it won't work on the subdomain (customercenter.rlaartistry.com) and yes I saved the file in the subdomain folder.

     

    I do appreciate all the feedback and I will rework the site and take the PHPs out of the database.

     

    If anyone has any links or other suggestions, please let me have it.

     

    Thank you again

  3. Please use the

    
    

    tags around your code, as it helps make both your post and your code a lot easier to read.

    Also, how to you store the form itself, and how to you include it into the page?

     

    Sorry about that.

    I basically copy and paste the form code into a long text field in the database, then in the index.php page I do a mysqli_query and echo the variable from it into the body. Its like a template, with 1 page and page ID determine the content and title. The same script can be seen here without the database and it works fine;

     

    http://customercenter.rlaartistry.com/Survey/new_site_survey.php?url=swatballers.org

     

    Not sure if I need to repost the form but here is the correct way;

     

      <span class="alert"><?php echo $errorMsg; ?></span>
      <form action="" method="post" name="newSiteSurvey">
      <span class="title_lg">1.</span> How likely are you to recommend RLA Artistry to a friend or colleague?<br /><br />
      <span class="alert"><?php echo $errorMsg1; ?></span>
    <table class="likelyTable" width="800" border="0">
      <tr>
        <td>Not likely at all</td>
        <td>Not Likely</td>
        <td>Neutral</td>
        <td>Likely</td>
        <td>Extremely Likely</td>
      </tr>
      <tr>
        <td width="160"><input type="radio" name="likely" value="1" id="likely_1" <?php if(isset($_POST['likely']) && $_POST['likely'] == '1'): ?>checked='checked'<?php endif; ?> /></td>
        <td><input type="radio" name="likely" value="2" id="likely_2" <?php if(isset($_POST['likely']) && $_POST['likely'] == '2'): ?>checked='checked'<?php endif; ?> /></td>
        <td><input type="radio" name="likely" value="3" id="likely_3" <?php if(isset($_POST['likely']) && $_POST['likely'] == '3'): ?>checked='checked'<?php endif; ?> /></td>
        <td><input type="radio" name="likely" value="4" id="likely_4" <?php if(isset($_POST['likely']) && $_POST['likely'] == '4'): ?>checked='checked'<?php endif; ?> /></td>
        <td><input type="radio" name="likely" value="5" id="likely_5" <?php if(isset($_POST['likely']) && $_POST['likely'] == '5'): ?>checked='checked'<?php endif; ?> /></td>
      </tr>
    </table>
    <hr />
        <p><span class="title_lg">2.</span> Think back to when you first visited RLAArtistry.com, were there any areas of the site that you think needed improvement? (select the most important one that applies):<br /><br />
    <span class="alert"><?php echo $errorMsg2; ?></span>
        <label>
          <input type="radio" name="RLASite" value="service" id="RLASite_0" <?php if(isset($_POST['RLASite']) && $_POST['RLASite'] == 'service'): ?>checked='checked'<?php endif; ?> />
          Finding the service that I wanted.</label>
        <br />
        <label>
          <input type="radio" name="RLASite" value="signup" id="RLASite_1" <?php if(isset($_POST['RLASite']) && $_POST['RLASite'] == 'signup'): ?>checked='checked'<?php endif; ?> />
          Creating my account (adding my contact information and uploading logo ).</label>
        <br />
        <label>
          <input type="radio" name="RLASite" value="design" id="RLASite_2" <?php if(isset($_POST['RLASite']) && $_POST['RLASite'] == 'design'): ?>checked='checked'<?php endif; ?> />
          Site appearance (Background, text color and site layout).</label>
        <br />
        <label>
          <input type="radio" name="RLASite" value="product" id="RLASite_3" <?php if(isset($_POST['RLASite']) && $_POST['RLASite'] == 'product'): ?>checked='checked'<?php endif; ?> />
          Product information.</label>
        <br />
        <label>
          <input type="radio" name="RLASite" value="like" id="RLASite_4" <?php if(isset($_POST['RLASite']) && $_POST['RLASite'] == 'like'): ?>checked='checked'<?php endif; ?> />
          Nope. I like RLA Artistry just as it is.</label>
        <br />
      </p>
    <hr />
      <p><span class="title_lg">3.</span> When you received your new website from RLA Artistry, did it meet your expectations?<br /><br />
    <span class="alert"><?php echo $errorMsg3; ?></span>
    <label>
          <input type="radio" name="expect" value="1" id="expect_0" <?php if(isset($_POST['expect']) && $_POST['expect'] == '1'): ?>checked='checked'<?php endif; ?> />
          It was even better than I had expected.</label>
        <br />
        <label>
          <input type="radio" name="expect" value="2" id="expect_1" <?php if(isset($_POST['expect']) && $_POST['expect'] == '2'): ?>checked='checked'<?php endif; ?>  />
          Yes, it was just as I expected.</label>
        <br />
        <label>
          <input type="radio" name="expect" value="3" id="expect_2" <?php if(isset($_POST['expect']) && $_POST['expect'] == '3'): ?>checked='checked'<?php endif; ?>  />
          Not exactly, I expected a little bit more, could be better.</label>
        <br />
        <label>
          <input type="radio" name="expect" value="4" id="expect_3" <?php if(isset($_POST['expect']) && $_POST['expect'] == '4'): ?>checked='checked'<?php endif; ?>  />
          The final product some what met my expectations but I am not completely satisfied.</label>
        <br />
        <label>
          <input type="radio" name="expect" value="5" id="expect_4" <?php if(isset($_POST['expect']) && $_POST['expect'] == '5'): ?>checked='checked'<?php endif; ?>  />
          No, I was disappointed. The final product didn't meet my expectations at all.</label>
        <br />
      </p>
          <input name="Submit" type="submit" class="button1" value="Submit" />
      </form> 
    

     

     

  4. You should give us the relevant code.

    Sorry about that, here is the code, it is a survey form and I want it to remember the value of the radio buttons. I also want after the form is submitted base on the value of question 3 to display a different exit message. Basically is the customer is satisfied they get a "thank you" and if the customer is dissatisfied they get a "sorry" on the thank you page.

     

    Here is the code for the "thank you" page:

     

    if($ans3 <= 2){
    header ("location: http://customercenter.rlaartistry.com/Survey/index.php?pid=3&conclusion=1");
    }else{
    header ("location: http://customercenter.rlaartistry.com/Survey/index.php?pid=3&conclusion=2");
    }

    And here is the form:

     

     

      <span class="alert"><?php echo $errorMsg; ?></span>
      <form action="" method="post" name="newSiteSurvey">
      <span class="title_lg">1.</span> How likely are you to recommend RLA Artistry to a friend or colleague?<br /><br />
      <span class="alert"><?php echo $errorMsg1; ?></span>
    <table class="likelyTable" width="800" border="0">
      <tr>
        <td>Not likely at all</td>
        <td>Not Likely</td>
        <td>Neutral</td>
        <td>Likely</td>
        <td>Extremely Likely</td>
      </tr>
      <tr>
        <td width="160"><input type="radio" name="likely" value="1" id="likely_1" <?php if(isset($_POST['likely']) && $_POST['likely'] == '1'): ?>checked='checked'<?php endif; ?> /></td>
        <td><input type="radio" name="likely" value="2" id="likely_2" <?php if(isset($_POST['likely']) && $_POST['likely'] == '2'): ?>checked='checked'<?php endif; ?> /></td>
        <td><input type="radio" name="likely" value="3" id="likely_3" <?php if(isset($_POST['likely']) && $_POST['likely'] == '3'): ?>checked='checked'<?php endif; ?> /></td>
        <td><input type="radio" name="likely" value="4" id="likely_4" <?php if(isset($_POST['likely']) && $_POST['likely'] == '4'): ?>checked='checked'<?php endif; ?> /></td>
        <td><input type="radio" name="likely" value="5" id="likely_5" <?php if(isset($_POST['likely']) && $_POST['likely'] == '5'): ?>checked='checked'<?php endif; ?> /></td>
      </tr>
    </table>
    <hr />
        <p><span class="title_lg">2.</span> Think back to when you first visited RLAArtistry.com, were there any areas of the site that you think needed improvement? (select the most important one that applies):<br /><br />
    <span class="alert"><?php echo $errorMsg2; ?></span>
        <label>
          <input type="radio" name="RLASite" value="service" id="RLASite_0" <?php if(isset($_POST['RLASite']) && $_POST['RLASite'] == 'service'): ?>checked='checked'<?php endif; ?> />
          Finding the service that I wanted.</label>
        <br />
        <label>
          <input type="radio" name="RLASite" value="signup" id="RLASite_1" <?php if(isset($_POST['RLASite']) && $_POST['RLASite'] == 'signup'): ?>checked='checked'<?php endif; ?> />
          Creating my account (adding my contact information and uploading logo ).</label>
        <br />
        <label>
          <input type="radio" name="RLASite" value="design" id="RLASite_2" <?php if(isset($_POST['RLASite']) && $_POST['RLASite'] == 'design'): ?>checked='checked'<?php endif; ?> />
          Site appearance (Background, text color and site layout).</label>
        <br />
        <label>
          <input type="radio" name="RLASite" value="product" id="RLASite_3" <?php if(isset($_POST['RLASite']) && $_POST['RLASite'] == 'product'): ?>checked='checked'<?php endif; ?> />
          Product information.</label>
        <br />
        <label>
          <input type="radio" name="RLASite" value="like" id="RLASite_4" <?php if(isset($_POST['RLASite']) && $_POST['RLASite'] == 'like'): ?>checked='checked'<?php endif; ?> />
          Nope. I like RLA Artistry just as it is.</label>
        <br />
      </p>
    <hr />
      <p><span class="title_lg">3.</span> When you received your new website from RLA Artistry, did it meet your expectations?<br /><br />
    <span class="alert"><?php echo $errorMsg3; ?></span>
    <label>
          <input type="radio" name="expect" value="1" id="expect_0" <?php if(isset($_POST['expect']) && $_POST['expect'] == '1'): ?>checked='checked'<?php endif; ?> />
          It was even better than I had expected.</label>
        <br />
        <label>
          <input type="radio" name="expect" value="2" id="expect_1" <?php if(isset($_POST['expect']) && $_POST['expect'] == '2'): ?>checked='checked'<?php endif; ?>  />
          Yes, it was just as I expected.</label>
        <br />
        <label>
          <input type="radio" name="expect" value="3" id="expect_2" <?php if(isset($_POST['expect']) && $_POST['expect'] == '3'): ?>checked='checked'<?php endif; ?>  />
          Not exactly, I expected a little bit more, could be better.</label>
        <br />
        <label>
          <input type="radio" name="expect" value="4" id="expect_3" <?php if(isset($_POST['expect']) && $_POST['expect'] == '4'): ?>checked='checked'<?php endif; ?>  />
          The final product some what met my expectations but I am not completely satisfied.</label>
        <br />
        <label>
          <input type="radio" name="expect" value="5" id="expect_4" <?php if(isset($_POST['expect']) && $_POST['expect'] == '5'): ?>checked='checked'<?php endif; ?>  />
          No, I was disappointed. The final product didn't meet my expectations at all.</label>
        <br />
      </p>
          <input name="Submit" type="submit" class="button1" value="Submit" />
      </form> 

     

     

    PHP should not be stored within a database.

     

    I might not have mentioned but I am a novice in self training with PHP. I am fluent in HTML and CSS, and do an awesome job in Photoshop, but not good at scripting. Is there an alternative to achieve the about without having the PHP in my database?

     

    Thanks again

  5. Hi,

    I recently started using PHP and have a bitter/ sweet relationship with it.

     

    I have a database that supplies the contents to my website using echo. Other contents will load fine except for echos. Instead of giving me the value it shows the entire code.

     

    Here is the link to the page I am working on:

    http://customercenter.rlaartistry.com/Survey/index.php?pid=2

     

    If more info is need I will gladly supply. I am a novice so please make you answer simple.

     

    Thanks in advance

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.