I’m trying to create a simple booking form. The are four options on a separate page (group, corporate, student and venue).
For example: If the user clicks Book Now for Group Experience it should take them to a dynamic page containing the form with the query string ‘Group-Experience’. This query string will be used for the value of the subject field.
Now the problem, At the moment this is what I have:
URL: /book/?menu=group-experience
subject field: “group-experience”.
I would like:
URL: /book/group-experience
subject field: “Group Experience”
I’ve got it so the -
is removed with:
<?php
$menu = str_replace ( "-", " ", $_GET['menu']);
?>
I’ve looked around StackOverflow and other websites but can’t find a method that works alongside WordPress – The form is inside a template file.
My current .htaccess
:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /lab/foodfiendexp/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /lab/foodfiendexp/index.php [L]
</IfModule>
You must add a page rewrite rule, to do that add the following code to functions.php
Then update the permalink structure from Settings -> Permalinks, you just hit save again.
And you access your menu with
Now you url should work with
considering book is a page, if you need to add the rewrite rule to a post, change it to a post rewrite rule
More details here: http://codex.wordpress.org/Rewrite_API/add_rewrite_rule
Also, if you need an rewrite rule inspector, this plugin is very very good: http://wordpress.org/plugins/monkeyman-rewrite-analyzer/