My variables postare lost on my online page (work fine locally using the exact same code). Here's how I retrieve them when I reload the page:
if ( isset($_POST['sub']) ) $sub = $_POST['sub']; else $sub = '';
if ( isset($_POST['contact_nom']) ) $contact_nom = $_POST['contact_nom']; else $contact_nom = '';
if ( isset($_POST['contact_prenom']) ) $contact_prenom = $_POST['contact_prenom' ]; else $contact_prenom = '';
if ( isset($_POST['contact_mail']) ) $contact_mail = $_POST['contact_mail']; else $contact_mail = '';
if ( isset($_POST['contact_sujet']) ) $contact_sujet = $_POST['contact_sujet']; else $contact_sujet = '';
if ( isset($_POST['contact_destinataire']) ) $contact_destinataire = $_POST['contact_destinataire']; else $contact_destinataire = '';
if ( isset($_POST['contact_message']) ) $contact_message = $_POST['contact_message']; else $contact_message = '';
Here is my form:
<form id='contact_form_mmt' action='<?php echo bloginfo("wpurl"); ?>/contact' method='post'>
<input type='text' name='contact_nom' placeholder='Votre nom *' data-validation='length' data-validation-length='min3' data-validation-error-msg='<?php echo $text_too_short_or_empty; ?>'>
<input type='text' name='contact_prenom' placeholder='Votre prénom *' data-validation='length' data-validation-length='min3' data-validation-error-msg='<?php echo $text_too_short_or_empty; ?>'>
<input type='text' name='contact_mail' placeholder='Votre mail *' data-validation='email' data-validation-length='min3' data-validation-error-msg='<?php echo $email_valid; ?>'>
<select name='contact_destinataire'>
<option value="contact@example.com|Information générales">Information générales</option>
<option value="webmaster@example.fr|Problèmes liés au site">Problèmes liés au site</option>
</select>
<textarea name='contact_message' placeholder='Message *'data-validation='length' data-validation-length='min3' data-validation-error-msg='<?php echo $text_too_short_or_empty; ?>'></textarea>
<input type='hidden' name='sub' value='1'>
<input type='submit' value='envoyer'>
</form>
All these variables (e.g., $subor $contact_nom) are populated when the page is reloaded on my local server. They are empty on my local server. Why does this problem arise and how to fix it?
[EDIT] here is the htaccess content, can the problem be there?
SetEnv PHP_VER 5_4
Options -Indexes
ErrorDocument 404 /index.php
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.example.fr$
RewriteRule ^(.*) http://www.example.fr/$1 [QSA,L,R=301]
source
share