I have a piece of code below:
// Check our data if (preg_match('/[^a-zA-Z0-9]/', $new_pagealias)) $error = "Invalid page alias. Use only normal characters."; if (preg_match('/[^a-zA-Z0-9]/', $new_pagekeywords)) $error = "Invalid page keywords. Use only normal characters."; if (!$new_pagealias) $error = "Page alias is missing"; if (!$new_pagename) $error = "Page name is missing"; if (!$new_pagetitle) $error = "Page title is missing";
This should check if $new_pagealias & $new_pagekeywords contain invalid characters, other than a-bA-B0-9 etc which works fine.
Well. The first one which checks the page alias works fine. The second one to check the keywords, doesn't. If I post a var to it containing the string '@' it will go through it and enter it into the database, same goes for the string "holiday, sunshine, ' " My HTML page will echo the meta etc ending with: holiday, sunshine, ' '/>
This ends the tag early which will error some browsers, plus I just want it to be perfect and not have to echo invalid keywords.
Plus I need the preg_match for $new_pagekeywords to validate and allow commas.
At the moment if I put the string "My house!" through alias & keywords, it will error for alias, but if I change alias to "house' and leave keywords as "My house!" it won't define $error & stop the SQL input.
Thanks in advance,