Skip to content

Tag: php

Form validation rules for regex_match

I’m trying to figure out what I’m doing wrong with this validation rule because its saying this error. Validation rule: Error: Severity: Warning Message: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash Answer First, you need to fix your pattern. Your pattern rig…

Add six months in php

I’m trying to get the month, six months out from the current date. I’ve tried using: date(‘d’, strtotime(‘+6 month’, time())); But it doesn’t seem to work, always returns 01. Is there a better way to do this? Thank you! Answer I find working with DateTime much easier …

How to use preg_match to match numbers between hyphens?

I need to validate strings like this: I need the penultimate number between hyphens, so in this case ’10’. These are other examples: Can you help me? Answer this RegExp should do the trick using a positive lookahead: (change 4 to whatever max num of digits you want to allow)

Remove double quote in json_encode()

I want remove double quote in my json_encode, that is my code: My result is that: I want to remove double quote of “id_posiciones” and “device_version” too. How can I do for the result is that: Answer If you add an underscore to your regex at the end it will do it. I assume that’…

Hidden Input Values not being passed through form to New URL

I have a small html file working in the frame of a website. It currently requests a zip code and then calls a php page to query the database. The iframe gets the id number from the parent page and then gets the zip code from its own page. Here is the code snippet. However, When I enter the zip