Visto che parliamo di php e il problema è lato server perché hai postato in javascript?