Quantcast
Channel: WordPress.com Forums » Recent Topics
Viewing all articles
Browse latest Browse all 74536

miiops on "Form redirecting correctly but showing index instead"

$
0
0

Hi everyone,
Kinda new to the WP forum world, yet not new to wordpressing (lol).
Anyway, I've been bumping my head against the wall for a while now with this issue, it's pretty much what the title says: I have a contact form, action being "" (empty), method being "post", when you submit it (just in case, I clarify, it's submitted via js with a link ("a" tag)), on the address bar it shows all the "correct" info, meaning the contact page, and if I hit F5 to refresh, it asks me if I want to resend the info, hence, the form is being submitted correctly (AND I also tried with method get, and it showed everything). However, the page displayed is the index page, even though the contact page shows properly when the php code shows the form.

I know I'm not the best at describing issues properly, soooo, here's part of the code, the most important part anyway:

<?php if ($_POST['reason']) : ?>
                        <?php
                            //$to='degiaweb@gmail.com, stefano.lenzi@dermaclinique.com, cristiano.vicini@dermaclinique.com';
                            $to='miiops@hotmail.com';
                            $subject='Contattaci Dermaclinique';
                            $headers='MIME-Version: 1.0'."\r\n";
                            $headers.='Content-type: text/html; charset=iso-8859-1'."\r\n";
                            $headers.='From: Dermaclinique <contattaci@dermaclinique.com>'."\r\n";
                            $message='MOTIVO: '.$_POST['reason'].'<br />';
                            $message.='NOME E COGNOME: '.$_POST['name'].'<br />';
                            $message.='TITOLO: '.$_POST['title'].'<br />';
                            $message.='NOME DELL\'AZIENDA: '.$_POST['company-name'].'<br />';
                            $message.='INDIRIZZO LINEA 1: '.$_POST['address-1'].'<br />';
                            $message.='INDIRIZZO LINEA 2: '.$_POST['address-2'].'<br />';
                            $message.='CITTA: '.$_POST['city'].'<br />';
                            $message.='STATO/PROVINCIA: '.$_POST['state'].'<br />';
                            $message.='CAP/CODICE POSTALE: '.$_POST['zip'].'<br />';
                            $message.='PAESE: '.$_POST['country'].'<br />';
                            $message.='INDIRIZZO EMAIL: '.$_POST['email'].'<br />';
                            $message.='TELEFONO: '.$_POST['phone'].'<br />';
                            $message.='FAX: '.$_POST['fax'].'<br />';
                            $message.='WEBSITE: '.$_POST['website'].'<br />';
                            $message.='DATA DI APPLICAZIONE: '.$_POST['date'].'<br />';
                            $message.='NOTE E COMMENTI: '.$_POST['notes'].'.';
                            $message=str_replace('\n.','\n..',$message);//replace . with .., so that when SMTP server removes one, the other stays
                            if (mail($to,$subject,$message,$headers)) :
                        ?>
                            <p style="text-align:center; height:323px;">
                                Grazie per aver contattato Dermaclinique.<br />
                                I nostri commerciali vi contatteranno nelle prossime 24 ore.
                            </p>
                        <?php
                            else :
                        ?>
                            <p style="text-align:center; height:323px;">
                                Mail not sent correctly. Re-try please.<br />
                                If the problem persists, contact system administrator.
                            </p>
                        <?php endif; ?>
                    <?php else : ?>
                        <p>
                            <span class="fc-purple">* I campi contrassegnati sono obbligatori</span><br />
                            <span class="fs-medium fc-grey">Contatta il nostro Dipartimento Commerciale completando i campi sottostanti.</span>
                        </p>
                        <form action="" method="post" name="contattaci">
                            <?php $reason=$_GET['reason'];?>
                            <?php if ($reason) : ?>
                                <input type="hidden" name="reason" value="<?php echo $reason; ?>" />
                            <?php else : ?>
                                <input type="hidden" name="reason" value="contact" />
                            <?php endif; ?>
                            <table cellspacing="5">
                                <?php if ($reason) : ?>
                                <tr>
                                    <td class="label fs-small">MOTIVO</td>
                                    <td class="field"><input type="text" name="reasonToShow" value="<?php echo $reason; ?>" disabled="disabled" /></td>
                                </tr>
                                <?php endif; ?>
                                <tr>
                                    <td class="label fs-small">NOME E COGNOME *</td>
                                    <td class="field"><input type="text" name="name" /></td>
                                </tr>
                                <tr>
                                    <td class="label fs-small">TITOLO *</td>
                                    <td class="field"><input type="text" name="title" /></td>
                                </tr>
                                <tr>
                                    <td class="label fs-small">NOME DELL'AZIENDA *</td>
                                    <td class="field"><input type="text" name="company-name" /></td>
                                </tr>
                                <tr>
                                    <td class="label fs-small">INDIRIZZO LINEA 1 *</td>
                                    <td class="field"><input type="text" name="address-1" /></td>
                                </tr>
                                <tr>
                                    <td class="label fs-small">INDIRIZZO LINEA 2</td>
                                    <td class="field"><input type="text" name="address-2" /></td>
                                </tr>
                                <tr>
                                    <td class="label fs-small">CITTA *</td>
                                    <td class="field"><input type="text" name="city" /></td>
                                </tr>
                                <tr>
                                    <td class="label fs-small">STATO/PROVINCIA *</td>
                                    <td class="field"><input type="text" name="state" /></td>
                                </tr>
                                <tr>
                                    <td class="label fs-small">CAP/CODICE POSTALE *</td>
                                    <td class="field"><input type="text" name="zip" /></td>
                                </tr>
                                <tr>
                                    <td class="label fs-small">PAESE *</td>
                                    <td class="field"><input type="text" name="country" id="ac_country" value="Enter country letters..." /></td>
                                </tr>
                                <tr>
                                    <td class="label fs-small">INDIRIZZO EMAIL *</td>
                                    <td class="field"><input type="text" name="email" /></td>
                                </tr>
                                <tr>
                                    <td class="label fs-small">TELEFONO *</td>
                                    <td class="field"><input type="text" name="phone" /></td>
                                </tr>
                                <tr>
                                    <td class="label fs-small">FAX</td>
                                    <td class="field"><input type="text" name="fax" /></td>
                                </tr>
                                <tr>
                                    <td class="label fs-small">WEBSITE</td>
                                    <td class="field"><input type="text" name="website" /></td>
                                </tr>
                                <tr>
                                    <td colspan="2" class="separator"></td>
                                </tr>
                                <tr>
                                    <td colspan="2" class="field"><span class="fs-small">NOTE E COMMENTI</span><br />
                                    <textarea name="notes"></textarea><br /></td>
                                </tr>
                                <tr>
                                    <td colspan="2" class="separator"></td>
                                </tr>
                            </table>
                            <p>
                                <a href="javascript:print();" title="Print page" class="fs-normal fc-grey"><img src="<?php bloginfo('stylesheet_directory'); ?>/resources/images/shared/shared-print.png" alt="shared/shared-print" /> STAMPA LA PAGINA</a>
                                <a href="#" title="SUBMIT" class="button align-right" onclick="$e(this).parents('form').submit(); return false;">
                                    <div class="filling">INVIA</div><!-- /filling -->
                                    <div class="right"></div><!-- /right -->
                                </a>
                            </p>
                        </form>
                    <?php endif; ?>

Anyway, thanks in advance!
Cheers!


Viewing all articles
Browse latest Browse all 74536

Trending Articles