Hello,
I am trying to do an if statement if a text fields includes a certain line of text.
For example
if ($data INCLUDES 'My name is Jim') {
print $data1
}
else {
print $data2
}
Hello,
I am trying to do an if statement if a text fields includes a certain line of text.
For example
if ($data INCLUDES 'My name is Jim') {
print $data1
}
else {
print $data2
}
Consider [man]strpos/man
Your trying to do that are you? Well done is your question supposed to be "how can I do this?" then try what laserlight suggested.
It seems to me like this is a long way around this problem. Surely there's an easier way?
$pos = strpos($data, "My name is Jim");
if ($pos === true) {
echo $data1;
} else {
echo data2;
}
I've already done it - thank you laserlight.
COUGH
Oh and if a problem is solved I have learnt from a vb forum that changin the topic title with [solved] at the end makes things easy for browsers lookin to help people. Just a suggestion.
Originally posted by Davy
COUGH
Oh and if a problem is solved I have learnt from a vb forum that changin the topic title with [solved] at the end makes things easy for browsers lookin to help people. Just a suggestion.
Clicking "Mark Thread Resolved" at the bottom is also a good alternative.
looks
wow I didn't even know that was there!!
thx