Jump to content

KateMacwil

Members
  • Posts

    26
  • Joined

  • Last visited

Posts posted by KateMacwil

  1. Hi

    I have a added a custom field to my posts called "Event Date".

    When I display my widget sidebar for recent posts the text "Event Date:" is showing, however my php variable is displaying instead of its contents.
    I have tried surrounding this var in <?php $sEventDate ?> - and nothing displays.

    I have also tried this: <?php echo $sEventDate ?> and still nothing displays

    What have I done wrong?

    issue-event-date.png

  2. Hi

    I am would like to display the date as "Jan. 3, 2018" (example).
    I have tried a few variations of trying to format my date field to the above and nothing is wokring for me.

    		<?php
    		$sEventDate = get_post_meta (get_the_ID(), "meta-text2", true);
       			
    		if ($sEventDate)
    		{
    		     echo "<div style=font-size: 14px;'>Event Date: $sEventDate</div>";
    		}
    		else
    		{
    		     echo "<div style=font-size: 14px;'>Event Date: --</div>";
    		}
    		?>

     

  3. Hi


    In my tenders table, I have a field called "id". The format of this field is "NNN-YYYY".
    Each tender that is added for the current year, 1 is added to the first 3 digits of the id field.
    Example: 100,2018, 101-2018, 102-2018, etc.

    Every year, the tender # is reset to 100 and the year is changed to current year.
    Example: 100-2019, 101-2019 etc.

    I have written the following statement and run the query below and it doesn't work ($sYear = current year)
    SELECT MAX(LEFT(id,3)) AS iMax FROM $table_name WHERE RIGHT(RTRIM(id), 4) = $sYear

    If I remove the LEFT(id,3), it does.
    SELECT MAX(id) AS iMax FROM $table_name WHERE RIGHT(RTRIM(id), 4) = $sYear

    So my MAX code isn't working and I am not able to :
    1) Figure out what is wrong with MAX(LEFT(id,3))
    2) Display and assign the iMax variable to a PHP variable
     

    Thanks.

     

     

     

    Below is my code:

    function GetNextTenderID()
    {
        global $wpdb;
        $table_name  	= $wpdb->prefix . "tenders";
        $sYear                   = date("Y");
        $sSql 		= "SELECT MAX(id) AS iMax FROM $table_name WHERE RIGHT(RTRIM(id), 4) = $sYear";
        $rows 		= $wpdb->get_results($sSql);
        $rowcount 	= $wpdb->num_rows;
    					
        if ($rows)
        {
    	    echo "Test to see if id displays" . $row->id;
           $old_num = $row->id;
            $new_num = (how do I get iMax) + 1;
        }
    
       return $sTemp;
    }

     

     


    Thanks.

     

     

     

     

     

     

     

  4. HI

    I have 3 select drop downs on my page - Status, Type and Year. Each have a few options the user can select from.
    When the user selects an option, a textbox is updated with this value.

    Each select drop down has their own onchange function,

    Below is an example of the Year select drop down.

    <select class="custom-select" name="filter-year"  onchange="FilterTendersYear(this);">>

    Here is my Javascript for this:

    function FilterTendersYear(selectObject)
    {
        var value = selectObject.value;  
        document.getElementById("textbox-year").value = value;
    }

    How can I re-write this function so that it will work with all my 3 select boxes on the same page?

     

     

  5. Hi

    I have created a file called tenders-update.php which allows the user to update an existing record.
    One of the fields (a select element called "type") is on this page.
    I have defined an array of available options for the type as follows:

       $options = array ('Construction' => 'Construction',  'Goods' => 'Goods',  'Services' => 'Services');

    I have also written a function which takes the $options array and the $type variable:
     

    MakeTypeOpts($options, $type)

    When I run this page, the select list contains the contents of the $options variable over and over and the $type variable is not selected.
    I am trying to figure out what I'm doing wrong here.

     

    tender-functions.php

    tenders-update.php

    screenshot-of-issue.png

  6. Hi

    I have created styles for my menu which aren't working as expected.

    I have attached a small portion of my page so you can see where I have referenced my menu class in the menu links.
    Although you can't see the call to my style sheet, it is in my original code.

    The menu links turn white on load and when I hover over the menu item, the underline works. However the active link
    is not working.

     

     

    tender-options.php

    styles.css

  7. Hi

    I have a php page called "tenders-add.php" that allows the user to add a record to the "tenders" table. The first field in the table is called "ID" and this field needs to be unique.

    In javascript, I have validated that the field is not empty, but I need to check somehow in my php code that this field is also unique to the table.

    I am stuck on how to accomplish this.

    tenders-add.php

  8. Hi

    I have written php code that displays to the user a list of all tenders in a database table.
    The user can sort on options displayed in the dropdown box and once a filter option
    is selected, the view automatically updates based on the selection.

    This part is working for me.

    However, I was trying to write code so that when you click the Download image on
    the page, a csv file is created containing the contents of the filtered view that is
    currently displayed.

    This part isn't working for me and any help pointing me in the right direction would
    be much appreciated.

     

    tender-functions.php

    tenders-list.php

  9. Hi

    I have tried to write some js code to validate the fields on my form and Im doing something wrong and
    can't figure out what it is.

    Here is my form code:

          <form name="Form1" action="">
          <table id="form_corners">
          <tr>
          <td>Name:</td>
          <td><input type="text" id="name" name="name" size="50" maxlength="60" onblur="ValidateField(name)" /></td>
          </tr>
          <tr>
          <td>Email:</td>
          <td><input type="text" id="email" name="email" size="50" maxlength="60" onblur="ValidateField(email)" /></td>
          </tr>
          <tr>
          <td width="120">Phone #:</td>
          <td><input type="text" id="phone" name="phone" size="50" maxlength="60" onblur="ValidateField(phone)" /></td>
          </tr>
          <tr>
          <td valign="top">Note:</td>
          <td><textarea id="note" name="note" rows="3" cols="39"></textarea></td>
          </tr></table>
          <br/>
          <div align="center">
          <input id="submit-btn-contact" type="submit" value="Send Now">
          </div>
         </form>

          <form name="Form1" action="">
          <table id="form_corners">
          <tr>
          <td>Name:</td>
          <td><input type="text" id="name" name="name" size="50" maxlength="60" onblur="ValidateField(name)" /></td>
          </tr>
          <tr>
          <td>Email:</td>
          <td><input type="text" id="email" name="email" size="50" maxlength="60" onblur="ValidateField(email)" /></td>
          </tr>
          <tr>
          <td width="120">Phone #:</td>
          <td><input type="text" id="phone" name="phone" size="50" maxlength="60" onblur="ValidateField(phone)" /></td>
          </tr>
          <tr>
          <td valign="top">Note:</td>
          <td><textarea id="note" name="note" rows="3" cols="39"></textarea></td>
          </tr></table>
          <br/>
          <div align="center">
          <input id="submit-btn-contact" type="submit" value="Send Now">
          </div>
         </form>

     

    validate.js

  10. Hi

    I have created a php file and would like to use the <iframe> tag to display the contents on a web page.

    I tried that as follows:


    <iframe src="/home/apldvhwt75w1/public_html/wp-content/plugins/my-schools/schools-users-view.php"
    width="800" height="500" frameborder="0"></iframe>

    and all I got was a blank page.

     

  11. HI

    In WordPress, I have created a simple plugin that allows the logged in user to:
    - Add a Tender
    - Update a Tender
    - Delete a Tender

    Now I need to be able to display a list of all the tenders to our visitors  (in table format).

    I am new to this and am not sure how to accomplish this task.

    Could someone please point me in the right direction?

    Much appreciated.

     


     

  12. Hi

    I have created a Contact 7 Form and added some custom css as shown below.

    When I click the Sign-Up button and don't enter any data, the red box displaying the error X is being cut off.

    I thought it might have been my border, so I removed that and tested and the issue persists.

    How do I resolve this?

    div#wpcf7-f3791-p3734-o1 {
    	border-radius: 25px;
        border: 2px dashed #0c6bb5;
        padding: 20px;
    }

     

    contact-error.png

  13. HJi

    I have created a new sidebar menu and for some reason one of the  menu items has a different text color.

    Not sure what I did wrong.

     

    #sub-navigation
    {
    background-color: #f6f6f6;
    margin: 0px;
    padding:0px;
    }
    
    #sub-navigation ul
    {
    list-style-type: none;
    margin: 0px;
    padding: 0px;
    }
    
    #sub-navigation li 
    {
    background-image: url("http://dev.townofbauline.ca/wp-content/uploads/2018/04/menuBack-01.jpg");
    background-repeat: repeat-x;
    color: #FFFFFF;
    text-decoration: none;
    font-family: Arial;
    font-size: 13px;
    font-weight: semi-bold;
    text-align: center;
    margin:0px;
    padding:0px;
    }
    
    #sub-navigation a:hover
    {
    background-image: url("http://dev.townofbauline.ca/wp-content/uploads/2018/04/menuBack-02.jpg");
    background-repeat: repeat-x;
    color: #FFFFFF;
    text-decoration: none;
    }
    
    #sub-navigation a:active
    {
    color: #FFFFFF;
    text-decoration: none;
    }
    
    #sub-navigation a:visited
    {
    color: #FFFFFF;
    text-decoration: none;
    }

     

     

     

    menu-prob.png

×
×
  • Create New...