That's fantastic thanks, it put me on the right path. I've amended it further because a few people had hyphenated surnames, so I changed the delimiter to an underscore. It now reads as follows:
RewriteRule ^people/([^_]*)_([^_]*)$ /people2?Name=$1&Surname=$2 [L]
which gives the following URL:
https://www.mydomain.co.uk/people/Name_Surname
I would like to take this one step further as some people have double-barrelled names with spaces, for example:
https://www.mydomain.co.uk/people/Leonardo_Da%20Vinci
should be
https://www.mydomain.co.uk/people/Leonardo_Da_Vinci
I used a str_replace in the URL on the results page like this:
a href="/people/<?php echo str_replace(“ “, ”_”, ($rsPractitioners->getColumnVal("Name"))); ?>_<?php echo str_replace( " ", "_", ($rsPractitioners->getColumnVal("Surname"))); ?>>"
However I can’t figure out how to alter the recordset on the details page to accommodate this.
<?php
$rsPractitioners = new WA_MySQLi_RS("rsPractitioners",$PowerCMSConnection_i,1);
$rsPractitioners->setQuery("SELECT * FROM practitioners WHERE practitioners.Name = ? AND practitioners.Surname = ?");
$rsPractitioners->bindParam("s", "".$_GET ['Name'] ."", "-1"); //ParamName
$rsPractitioners->bindParam("s", "".$_GET ['Surname'] ."", "-1"); //ParamSurname
$rsPractitioners->execute();
?>
I tried the following but it doesn’t work:
<?php
$rsPractitioners = new WA_MySQLi_RS("rsPractitioners",$PowerCMSConnection_i,1);
$rsPractitioners->setQuery("SELECT * FROM practitioners WHERE practitioners.Name = ? AND practitioners.Surname = ?");
$rsPractitioners->bindParam("s", "". str_replace(" ", "_", "$_GET ['Name']") ."", "-1"); //ParamName
$rsPractitioners->bindParam("s", "". str_replace(" ", "_", "$_GET ['Surname']") ."", "-1"); //ParamSurname
$rsPractitioners->execute();
?>