View Full Version : Problem with anchor and name tags in php

02-25-2008, 08:39 AM

Does the fact that I am linking to a php file mean that I can not use and anchor name tag eg :
<a name="renew"></a>

I am trying to give a refresh and show the form agian without the user having to scroll down.

So I am using :
<a href="index.php#renew">Renew</a>

Maybe I haven't done it correctly ?
Any help, much appreciated.

This is my php page :

<Div class="formfill">
<H2> Claim Your <span class="big_let_01">FREE</span> Entry NOW!</H2>
<P><a name="renew"></a>
<INPUT type="checkbox">
<B>Fill out the form below</B> and
you'll immediately receive <B>FREE</B> entry to our internet business coaching system.
Put an end to the frustration.
<br>Start today: I am waiting to send you your free login details.

<form name="main_fm1" action ='index.php' method = 'POST'>
<div class="form_table">
<span><input type='hidden' name = 'run_mn1' value = 'yes' ></span>

<span class="tab-cell-left">Enter Your First Name:</span>
<span class="tab-cell-right"><INPUT name="x_contact" value= '<?php echo "$N_contact"; ?>' size="28" type="text"></span>

<span class="tab-cell-left">Your <span style="text-decoration: underline;">main</span> Email Address:</span>
<span class="tab-cell-right"><INPUT name="x_email" value= '<?php echo "$N_email"; ?>' size="28" type="text"></span>

<span class="tab-cell-left">Give yourself a Password:</span>
<span class="tab-cell-right"><INPUT name="x_pass" size="28" type="password"></span>

<span class="tab-cell-left" style="height: 40px; vertical-align: center;">Verfication Image:</span>
<span class="tab-cell-right" style="height: 40px; "><img src="captcha.php"> <a href="index.php#renew">Renew</a></span>

<span class="tab-cell-left">Enter 8 character key:</span>
<span class="tab-cell-right"><input type="text" name="imgver" id="imgver"></span>

<input class="button" type="submit" value="Give Me Free Entry Now"/>

</div> <!-- END FORM TABLE -->
</Div> <!-- END FORM FILL -->

02-25-2008, 08:57 AM
I don't see any error in it...It is working apparently,,it just ain't that visible enough..
Maybe you can check it out if it's working by adding a number of <br/> tag before
<span class="tab-cell-right" style="height: 40px; "><img src="captcha.php"> <a href="delete.php#renew">Renew</a></span>

I just tested it here...and it works...or simply i'm not taking this right :D

02-25-2008, 09:39 AM
Well I ran it again and scrolled around
it is going to the name ref
so in a way, it works
- but I wanted it to re-load the php
so that I get a new captha image shown.
maybe the href wont re-load the file if it is already loaded ?

maybe I need to do this with js ?

02-25-2008, 09:52 AM
Now...i understand it :D
You could either choose from this three codes:
<span class="tab-cell-right" style="height: 40px; "><img src="captcha.php"><a href="index.php#renew" onClick="window.location.reload()">Renew</a></span>
<span class="tab-cell-right" style="height: 40px; "><img src="captcha.php"><a href="index.php#renew" onClick="history.go(0)">Renew</a></span>
<span class="tab-cell-right" style="height: 40px; "><img src="captcha.php"><a href="index.php#renew" onClick="window.location.href=window.locationi.href">Renew</a></span>

02-25-2008, 10:55 AM
That looks great :thumbsup:

I will use the first one:

span class="tab-cell-right" style="height: 40px; "><img src="captcha.php"><a href="index.php#renew" onClick="window.location.reload()">Renew</a></span>

as it looks more intuitive ( big word ) :)

02-25-2008, 10:57 AM
No problem!...You're welcome :D

02-25-2008, 02:03 PM
If you want to refresh the image without reloading the page you can use something like this:

<img src="captcha.php" id="captcha" /><br />
<a href="#renew" onclick="javascript: document.getElementById('captcha').src = 'captcha.php?' + Math.random();">refresh</a>

02-25-2008, 07:03 PM
Mr Inigoesdr ... I suppose thats not bad .

actually it really does the biz - brilliant :thumbsup:

Just one thing - why is the "+ Math.random()" needed ?

Doesn't the captcha.php already randomize it ?


02-25-2008, 08:01 PM
You need to add a random number to the URL so the browser considers it a different file, and consequently re-requests the image from the server.

02-25-2008, 08:09 PM
OH - I see - nothing to do with the capctha ramdomizer.

( Nice to get that sorted - just my email playing up now ...
... but thats another thread :) )