Pergunta

i am at prototype stage.

I made my custom e-mail php pages with post-redirect-get approach. my question is:

I intentionally making mistake while filling e-mail form. Name must be alphanumeric but the name I enter is not alphanumeric. As I expect my verification page redirects to the mail sending page with error warnings.

the url is exactly what I expect but I can't print the url GET values to the screen despite the fact that I checked my variables. Can you please help me?

Why can not I print the values from url to screen via $_GET variables? What should I do?

thanks, BR

the url with error warning (as I expected)

http://localhost/english/contact?if_isim=john!*nash&if_eposta=example@dot.com&if_mesaj=message&eposta_hatalari=Only%20letters%20and%20numbers%20are%20allowed%20in%20name%20input.%3Cbr%20/%3E

and my related page which I expect to populate previously filled inputs and print the accumulated error messages. (but does nothing)

<?php 
//okur bilgileri kaybolmasın
if (!isset($_GET['if_isim'])) {$if_isim_d = "";} else {$if_isim_d = $_GET['if_isim'];}
if (!isset($_GET['if_eposta'])) {$if_eposta_d = "";} else {$if_eposta_d = $_GET['if_eposta'];}
if (!isset($_GET['if_mesaj'])) {$if_mesaj_d = "";} else {$if_mesaj_d = $_GET['if_mesaj'];}

//hata mesajı
if (!isset($_GET['eposta_hatalari'])) {$hatali_eposta_d = '';} else {$hatali_eposta_d = $_GET['eposta_hatalari'];}
?>

            <div class="sol-icerik-kapsar">
                <?php if ($hatali_eposta_d !='') {echo $hatali_eposta_d;} //varsa hatalar yazdırılıyor ?>
                <form method="post" id="iletisim-formu" action="<?php echo sitenin_koku.'eposta-doğrula'; ?>">
                        <fieldset id="fset-iletisim">
                            <legend id="leg-iletisim" class="font75"><?php if ($page_language == 'tr') {echo 'İletişim Formu:';} else {echo 'Contact Form:';} ?></legend>
                            <label for="if_isim"><span class="font75"><?php if ($page_language == 'tr') {echo 'İsminiz:';} else {echo 'Name:';} ?></span></label><br />
                            <input type="text" value="<?php echo $if_isim_d; ?>" name="if_isim" id="if_isim" /><br />
                            <label for="if_eposta"><span class="font75"><?php if ($page_language == 'tr') {echo 'E-posta adresiniz:';} else {echo 'E-mail:';} ?></span></label><br />
                            <input type="text" value="<?php echo $if_eposta_d; ?>" name="if_eposta" id="if_eposta" /><br />
                            <input type="hidden" name="dilang" value="<?php echo $adres_get_elemanlari[0]; ?>">
                            <label for="if_mesaj"><span class="font75"><?php if ($page_language == 'tr') {echo 'Mesajınız:';} else {echo 'Message:';} ?></span></label><br />
                            <textarea rows="6" cols="20" name="if_mesaj" id="if_mesaj"><?php echo $if_mesaj_d; ?></textarea><br />
                            <input type="submit" id="epostayolla" class="font75" value="<?php if ($page_language == 'tr') {echo 'Gönder';} else {echo 'Send';} ?>" />
                        </fieldset>
                </form><!-- end #iletisim-formu -->
            </div><!-- end .sol-icerik-kapsar -->

I am suspecting that maybe I should use URLENCODE() somewhere! Hope it lights a bulb in your mind.

Foi útil?

Solução

I used print_r($_GET) and I saw that $_GET doesn't carry my additional values that comes from the form elements and error variable.

My issue directly related with this and this and this posts.

Explicitly, my issue was: Without a proper .htaccess setup, it may be not possible to add $_GET variables to (mod rewrite powered) SEO friendly nice URLs.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top