PDA

View Full Version : PHP Video Tutorials / function submiter () script help / Repeat region help


tux
03-14-2007, 12:04 AM
Hi, All,

Got a few probs I need help with but first a big thanks to Davidj. He has help me out recently and I have just sat and watch his excellent tutorials on PHP for beginners. I recommend you take a look. Go here :

http://www.dreamweaverclub.com/vtm/php-mysql-apache.php

( whens the next David )

Ok, first prob, Davidj wrote me a submiter script for a jump menu to pass an ID with the URL, the post is here :

http://www.dreamweaverclub.com/forum/showthread.php?p=121222#post121222

Can anyone add to it for me so that it will send two different IDs, in my case a photographerID and an imageID. Thanks.

Next prob I have is a repeat region prob. I have a gallery page that is populated with thumbnails using a repeat region and recordset paging. Each thumb has a link that sends the imageID to the URL to display the correct full size image. This works fine until the next set from the rs paging is called. When you then click on a thumb, the full image displays but the previous/first set of thumbs displays instead of the current ones. Does anyone have any ideas why. If this makes no sense let me know and I'll post the address so you can see for yourself what happens.

Thanks all, regards

Paul

tux
03-15-2007, 02:24 PM
If it helps, this is the code for the submiter function together with the form. So, how can I include an imageID with the photographerID. Thanks.
----------------------------------------------------------------
<script language="javascript" type="text/javascript">

function submiter(){

id = document.getElementById('menu').value;

if(id != '0'){
document.location.href='gallery_detail.asp?photogr apherid='+id;
}

}
</script>

----------------------------------------------------------------

<form id="form1" name="form1" method="post" action="">

<div align="right">
<select name="menu" class="photographerlist" onchange="submiter()">
<option value="">choose a photographer</option>
<%
While (NOT rs_photographerlist.EOF)
%>
<option value="<%=(rs_photographerlist.Fields.Item("photographerID").Value)%>"><%=(rs_photographerlist.Fields.Item("firstname").Value)%></option>
<%
rs_photographerlist.MoveNext()
Wend
If (rs_photographerlist.CursorType > 0) Then
rs_photographerlist.MoveFirst
Else
rs_photographerlist.Requery
End If
%>
</select>

</div>
</form>

davidj
03-15-2007, 06:01 PM
where you have this...

id = document.getElementById('menu').value;

if(id != '0'){
document.location.href='gallery_detail.asp?photogr apherid='+id;

look at my example and try to figure it out...


id = document.getElementById('menu').value;
phid = document.getElementById('photo').value;


if(id != '0'){
document.location.href='gallery_detail.asp?photogr apherid='+id+'&photo='+phid;

tux
03-15-2007, 11:16 PM
Okay David, I give up!! Tried for ages to figure it out. Nothing I did seem to work.

Please put me out of my misery before I turn in.

Paul

davidj
03-16-2007, 08:44 AM
ok...

id = document.getElementById('menu').value;
phid = document.getElementById('photo').value;


if(id != '0'){
document.location.href='gallery_detail.asp?photogr apherid='+id+'&photo='+phid;


phid is the image ID and that value is stored in a field called photo in the form you submit.
phid = document.getElementById('photo').value;

then i have taken this variable (phid) and appended it to the url string..
document.location.href='gallery_detail.asp?photogr apherid='+id+'&photo='+phid;

tux
03-16-2007, 09:27 AM
Thanks David,

It all comes clear.

I think I told you this site has got to be ASP due to hosting restrictions. I tried PHP and MySQL a while back and struggled with creating MySQL DB's. I was using the dos prompt and having to build the DB's blind as it were and not being a programmer found it hard and so got put off of PHP.

But now I have watched your vids and found out about ESM MYSQL LITE I'm going to bite the bullet and get to grips with it on my next project which is another photography site for my brother.

Back on my current probs, any idea why my repeat region doesnt work correctly. ( see my first post for details )

Thanks David. Regards

Paul

tux
03-16-2007, 07:55 PM
Hi again David,

Still a bit foxed with the form thing. The syntax you posted makes sense to me but I couldnt seem to add the extra form field. Is it because its a jump menu. Where would the "photo" field fit into the form. Dreamweaver wouldnt let me add a new form because its a jump menu and I couldnt suss out how to add one manually. Cheers.

Paul