Jump to content

RobDgital

Members
  • Posts

    11
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

RobDgital's Achievements

Member

Member (2/5)

0

Reputation

  1. Many thanks Kicken! Your explanation makes a ton of sense with the anser as well. I really appreciate this
  2. Hi all. After being away from coding and trying this for a while I have been asked to assist someone with something and I am not winning.....or understanding how to check the form validation coming though. The 'friend/client' needs to check that the form field filled in begins with 'DT' (either upper case or lower case) can have a space(or not) then a series of 7 numbers. For example 'DT 1234567' or 'dt1234567' I am really not understanding how to do this. I have started with some sample code /** * Validate UM DT Number field for registration dt_number2 * @param string $key * @param attay $array * @param array $args */ function um_custom_validate_dt_number2( $key, $array, $args ) { if ( isset( $args[$key] ) && !preg_match('/^[6-9]\d{9}$/', $args[$key]) ) { UM()->form()->add_error( $key, __( 'Please enter a valid DT Number.', 'ultimate-member' ) ); } } add_action( 'um_custom_field_validation_dt_number2', 'um_custom_validate_dt_number2', 30, 3 ); but for the life of me, everything I have tried on sites like http://www.santic.org/preg_match/ just dont work, I get errors all the time. The best I can do is check that there is a DT in the string! /(TD)\w*/i checked against my string TD 1234567, 1236547 TD, 123DT4567 gives me 2 results, but as soon as I try check for numbers etc /(TD)+[0-9]\d{7}\w*/i I am failing. Please someone guide me!
  3. Hi I have a page that the user selects a category and I have the page sending a variable to a page. However, I want the user to be able to select multiple options and therefore need the page doing the query to build an array and change the search results accordingly! Please can someonehelp me with what I have as I am jsut NOT getting my head around this! Here is the 'form' info <input name="jqdemo" value="6" type="checkbox" id="party"/> <label for="party"></label> <a class="checkbox-select" href="# id="6" onclick="showUser(this.id)""><img src="Assets/images/blank.png" alt="" width="120" height="180" /></a> <a class="checkbox-deselect" href="#" id="0" onclick="showUser(this.id)"><img src="Assets/images/blank.png" alt="" width="120" height="180" /></a> Then this is the page that is doing the query <?php $q=$_GET["q"]; $con = mysql_connect('localhost', 'root', ''); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("db_pyf", $con); //$sql="SELECT * FROM tbl_product WHERE cat_id IN '".$q."'"; $sql="SELECT * FROM tbl_product WHERE cat_id IN (3,1,2)"; $result = mysql_query($sql); echo "<table border='1'> <tr> <th>Firstname</th> <th>Lastname</th> <th>Age</th> <th>Hometown</th> <th>Job</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['prod_name'] . "</td>"; echo "<td>" . $row['prod_desc1'] . "</td>"; echo "<td>" . $row['member_id'] . "</td>"; echo "<td>" . $row['cat_id'] . "</td>"; echo "<td>" . $row['cat_id'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> But, as I have said, I want the user to be able to select multiple options and want the search to adjust accordingly!
×
×
  • 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.