I'm pretty new to webcoding and would like to improve a bit in php, but I'm already stuck :/
What I am trying to do is to have a sentence like
"Simon likes apples"
Now I have an input form for the name so I can choose the name. So it looks like
"$name likes apples"
<table>
<tr>
<td><input type="text" id="name1" name="name1"></td>
<td><input type="submit" id="submit" name="submit" value="Apply"></td>
</tr>
</table>
</div>
<div id="text">
<?php
if(isset($_REQUEST['submit'])) {
$name1 = $_REQUEST['name1'];
echo "$name1 likes apples.";
}
?>
</div>
</form>
Everything fine till now. Whatever name I type in replaces $name. Now what I want to do is to change the "likes" to "like" whenever i type in a pronoun (I, You, They etc.), which makes sense obviously. Now here is where I don't know what to do. My current code (which doesnt work) looks like this:
<?php
if(isset($_REQUEST['submit'])) {
$name1 = $_REQUEST['name1'];
if ($name1 = "I", "You") {
$verb = "like";
}
else {
$verb = "likes";
}
echo "$name1 $verb apples";
}
?>
Also is there a way to make it case insensitive?