• Content count

  • Joined

  • Last visited

  • Days Won


dsonesuk last won the day on May 17

dsonesuk had the most liked content!

Community Reputation

642 Excellent


About dsonesuk

  • Rank
    w3schools Guru
  • Birthday July 15

Contact Methods

  • ICQ

Profile Information

  • Gender

Recent Profile Visitors

74,001 profile views
  1. Some older browsers require prefixes -moz-, -web-kit-, -ms-, -o- (Firefox, Chrome, Safari, IE, Opera) to work for specific versions.
  2. If they are default, then that could be problem, they ade wide by default, 1 is not pixel unit but cm or inch, you also have option to show images or not, top and bottom page headings etc.
  3. Valid result: The value is processed and returns with 'return $data;' and stops going any further. The $alternative variable has no set value because of this and so is NULL. So red warning won't proceed any further. Invalid result: The process skips if condition and processes $alternative and returns with 'return $alternative;'. BUT! the '$alternative' elseif is specifically targeting a boolean type of TRUE, this will never pass this as its type is 'string' not boolean. The if condition 'if (valid_someting($data)) {' is different it checks the value of returned data, and being a just a string it will always return TRUE unless it equals '0', because it is not specific to a boolean type, it can be string, integer, or array. IT will work if you use 'if(is_string($alternative))' but it will return one of the function return values, plus the $alternative set value, meaning both will be processed in the if and elseif conditions. Check out example below <?php //$alternative="empty"; function valid_someting($data){ global $alternative; echo ' current $alternative value: <br>'; echo 'boolean value BEFORE IF: ' . getType($alternative) . ' "' . $alternative . '"<br><br>'; $count=0; $count = strlen($data); if ( ($count < 8 && ($count > 4) ) ) { $data = preg_replace('/[^a-zA-Z0-9!@#$%^&*()\-_=+{};:,<.>]/', '', $data ); // $data = ltrim($data); $data = rtrim($data); $data.='aaaa'; return $data; } $alternative = $data; echo 'boolean value AFTER IF: ' . getType($alternative) . ' "' . $alternative . '"<br><br>'; $alternative.='bbbb'; return $alternative; } $data = 'abcdabcdabcd'; //$data = 'abcda'; $result=valid_someting($data); if ($result) { echo 'boolean value of $data function IF: ' . getType($result) . ' "' . $result . '"<br><br>'; echo 'color input field green'; } if ($alternative==TRUE) { echo 'color input field RED'; } echo '<br><br>boolean value of $alternative AFTER ELSEIF: ' . getType($alternative) . ' "' . $alternative . '"<br>'; The best option is in previous example, where you return a true or false, to compare with if or else.
  4. IF you are checking if string length is valid and return false or true <?php function valid_someting($data){ $count = strlen($data); $valid = false; if ( ($count < 8 && ($count > 4) ) ) { $data = preg_replace('/[^a-zA-Z0-9!@#$%^&*()\-_=+{};:,<.>]/', '', $data ); // $data = ltrim($data); $data = rtrim($data); $valid = $data; } return $valid; } $data = 'abcdabcdabcd'; //$data = 'abcddd'; if (valid_someting($data)) { echo 'color input field green<br>'; } else{ echo 'color input field RED<br>'; } Set false to variable returned, if valid in if condition, reset it to true (or include string, but resetting to true would be best)
  5. IF you are saying 'color input field green' is returned if string length is inside or outside the if condition, it is because a string always returns true (unless "0"), while comparing with '==' a string will always be TRUE, but first if condition takes priority. Check out http://php.net/manual/en/types.comparisons.php.
  6. .node-type-properties h1 { background-image: url("/rincon/sites/default/files/bg-blue.png"); background-repeat: no-repeat; color: white; font-size: 55px; background: #ccc none repeat scroll 0 0; height: 200px; text-align: center; } .node-type-properties h1::before { content: ""; display: inline-block; height: 100%; vertical-align: middle; } .node-type-properties h1 span { display: inline-block; vertical-align: middle; } <div class="node-type-properties"><h1><span>TODO write content, TODO write content</span></h1></div>
  7. I do not know WHAT you want now? you said you want the sub dropdown to show data from database depending what is passed back from parent dropdown, it may or may not work? then you talk about inserting? then you find a script that uses $conn? Maybe you should learn to understand MYSQL, PHP, SQL first! Instead of just finding any script that may/nearly produces the required results. and pasting into your own, and then get us to unravel third party code for you, which unrelated to your current code. Message me! well sorry, that's not going to happen.
  8. Then I dont understand?, if you insert manually the correct value in SQL statement, it works but! if the value returned by $_POST is the same as the manually entered value it does not, that just does not make sense.
  9. IF $db represent connection to database, what is $conn? You just require single variable connection to a single database. For each select statement attached to $query variable you call $db->query($query); directly following it and process the results following that. IF you manually insert a value instead of a variable, does it produce correct result, if it does not then the select query is faulty.
  10. Should it not be where b.willlose='.$willlose.' ' And does the values in 'willose' column have a space after the value as shown by using .' ' on the search value?
  11. I suppose you have checked Page Setup to change default margins?
  12. IS $willlose = mysql_real_escape_string($_POST['willlose']); returning a value? Just make sure it returns a value first, and this </select></div> should be UNDER the php outputted options.
  13. The array is treated as tables, the value from first dropdown is used to show other related info from related array/table info. The way the second dropdown is processed can be placed in another php file, which is called by using ajax. This is a rough guide on how to send info from first to second dropdown, the principle is the same, I did not reproduce the effect using your code, as you seem to want us to do it for you, as you keep saying you tried this and that! But! don't actually show us what code you tried, just the repeated showing of the same code. <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <?php if (isset($_POST['willwin'])) { $teamRec = $_POST['willwin']; } $team_array = []; $team_array['Team1'] = ['Team #1 dropdown1', 'Team #1 dropdown2', 'Team #1 dropdown3', 'Team #1 dropdown4']; $team_array['Team2'] = ['Team #2 dropdown1', 'Team #2 dropdown2', 'Team #2 dropdown3', 'Team #2 dropdown4']; ?> <form id="myform" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>"> <select name="willwin" class="form-control"> <option value="">Select Team </option> <?php $optioncount = 0; foreach ($team_array as $key => $value) { $optioncount++; if ($key === $teamRec) { echo '<option class="team' . $optioncount . '" value="' . $key . '" selected="selected">Team #' . $optioncount . '</option>'; } else { echo '<option class="team' . $optioncount . '" value="' . $key . '">Team #' . $optioncount . '</option>'; } } ?> <!--<option class="team1" value="Team1">Team #1</option> <option class="team2" value="Team2">Team #2</option>--> </select><br> <?php if (isset($_POST['willwin'])) { echo '<select name="tagged" class="form-control">'; echo '<option value="">Select Team Info </option>'; $team_array_item = $team_array[$teamRec]; foreach ($team_array_item as $key => $value) { echo '<option value="' . $value . '">' . $value . '</option>'; } echo '</select><br>'; } ?> <input type="submit"> </form> </body> </html>
  14. When the form is submitted,OR the select dropdown triggers a onchange event that uses AJAX, it should pass the value of selection using $_POST[] or $_GET to the second dropdown. It usually uses this value to filter and access the related records, but I currently do not see any fields that would possibly do that? All I see is filtering by 'auc_id', is this relative value passed through by team1 or team2?
  15. Rough example $sql = "SHOW COLUMNS FROM TableName"; $stmt = $pdo->prepare($sql); $stmt->execute(); $arr = []; while ($row = $stmt->fetchObject()) { //check if column is non auto_increment if ($row->Extra !== 'auto_increment') { $arr[] = $row->Field; } } $convert_arr = implode(', ', $arr); $ins_sql = "INSERT INTO TableName ($convert_arr)VALUES (11, 4)"; $pdo->exec($ins_sql); You could even use column names retrieved to retrieve $_POST/$_GET name values of the same named index.