-
Posts
3,145 -
Joined
-
Last visited
-
Days Won
37
Community Answers
-
cyberRobot's post in Add Separator to Wordpress Function was marked as the answer
Since get_the_category() returns an array, you could use implode(). More information can be found here:
http://php.net/manual/en/function.implode.php
-
cyberRobot's post in Fitering an array was marked as the answer
You could try something like this:
$matchingIndex = ''; foreach($yourArray as $currIndex => $subArray) { if($subArray[1] == 'Zurich Life') { $matchingIndex = $currIndex; break; //break out of the loop, since you found Zurich Life } } -
cyberRobot's post in Warning: Cannot modify header information was marked as the answer
As mac_gyver mentioned, nothing can be outputted to the screen before calling header(). Since you're just redirecting the user, the header() call can be moved to the top of your script.
<?php //lets check the user is authorised to be here! if ($userLevel > 3){ echo "you are authorised to be here!"; } else { header('Location: ../index.php'); exit; } //this is going to be the main section for reporting include('../header.php'); ?> Note that I added the "exit" statement after the header() call to prevent the script from doing any further processing. If you want to display a message before the page is redirects, you could look into using header() and "refresh". An example can be found here: http://php.net/manual/en/function.header.php#97114 -
cyberRobot's post in PHP Selection not showing on selction on dropbox was marked as the answer
You're using "SymptomId" here:
<select name="Symptom" id="SymptomId" onchange="Symselect()"> And "Symptomid" here:
var x = document.getElementById("Symptomid").value; Those values need to match. Note: the values are case sensitive.
Note that I moved the topic to the JavaScript forum.
-
cyberRobot's post in HTML select and option work with PHP database was marked as the answer
How is the "birthdate" field stored in your database? If it is stored as a string and only contains the month, you would need to add quotes around the value from $select.
$birthdate = "SELECT CONCAT(FirstName,' ',LastName) AS Birth FROM Members WHERE birthdate = '" . $select . "'"; Side note: you'll want to look into using prepared queries...or use mysqli_real_escape_string() to protect yourself from SQL injection attacks.
-
cyberRobot's post in php and html contact form help was marked as the answer
One thing that I noticed is that the email entered through the form is being saved to $email.
$email = $_POST['email']; But the if test uses $email_from.
if(!preg_match($email_exp,$email_from)) {