Gossamer Forum
Quote Reply
Rate...
Ok, I'm a little confused here. In rate.html (php templates) you have thefollowing hidden tags;

<input type="hidden" name="do" value="rate">
<input type="hidden"name="action" value="rate">
<input type="hidden" name="link_id"value="<?print $link_id">

Now, I'm a little confused as to why you define both 'action' and 'do'. Isthis an accidental insert, or is there logic behind having both of there???Crazy

Oh, and also a possible bug for you to squish Tongue

When you submit a number over 5 (or non-numeric) for the rating you getthe following error message;

Please enter a number from 1 to 5.

Is it the PHP that needs editing, or is it just a simple case of editing thedrop down box to only hold 1 through 5 as options? Unsure

Thanks

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Rate... In reply to
Isn't this a bug too?

<input type="hidden" name="link_id"value="<?print $link_id">

Note the missing bracket?
Quote Reply
Re: [RedRum] Rate... In reply to
Yeah, it should be;

<input type="hidden"name="link_id"value="<?print $link_id?>">

Probably my fault, and not GT's Wink

Anyway, I have that rating problem solved (all except the weird error messagewhere it says you can only vote to 5). I needed both the 'action' and 'do'hidden fields in there. I think I slightly understand the logic behind themnow.

'do' tells page.php what file to include and execute, and then 'action' tellsthe script that it has had a submissions and it needs to do something about itand add it to the database Tongue Dunno why I didnt think about that earlier!lol




Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Rate... In reply to
Andy,

I haven't checked the code before responding, but I would say you do need both of them. One of them would be to pull the correct handle() function, and the second would be to let it know to log the vote rather then display the form.

I'm not 100% sure that is it, but it seems logical to me. Gotta go.

Cheers,
Michael Bray
Quote Reply
Re: [AndyNewby] Rate... In reply to
In Reply To:
When you submit a number over 5 (or non-numeric) for the rating you getthe following error message;
hmm... doesn't do it here :) Not sure if I've changed that code since then. I believe the error message was changed for the review templates -- incorrectly changed, since that error message is now used for both ratings, and reviews (ratings is 1-10, while reviews is 1-5).

In Reply To:
Now, I'm a little confused as to why you define both 'action' and 'do'. Isthis an accidental insert, or is there logic behind having both of there???
Nope, that's right. do=rate puts it into the 'rate.cgi' mode. And then action=rate is telling it what action of the rate code to perform.


Adrian
Quote Reply
Re: [brewt] Rate... In reply to
Yeah, I've been trying to reproduce that error again, but havnt had muchluck. If I do get it again I'll let you know, and how I produced it Tongue

Also, has the add function in PHP been tested much with extra fields? I'mgetting some weird problems with it which I cant seem to work out. If someonesubmits a listing with all the default fields, it works fine and you get thesubmission success page. However, if there are extra fields it just takes youback to the add page. The even weirder thing is that $error does not actuallyhold an error, even though it must hold something as the following code is in mypage;

<?if ($error) { ?>there was an error. It was <?print$error?><? } ?>

The message "There was an error. It was" shows up fine, but there just doesntseem to be an error message printed!

Any more ideas? Unsure Oh, and good job so far. I dont know where I would bewithout page.php now....considering most of my site runs on PHPTongue

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

AndyNewby: Jan 6, 2002, 2:33 AM
Quote Reply
Re: [AndyNewby] Rate... In reply to
I know nothing about php but wouldn't this:

<?if ($error) { ?>there was an error. It was <?print$error?><? } ?>

be better as:

<?if ($error) { echo "there was an error. It was $error"; } ?>
Quote Reply
Re: [AndyNewby] Rate... In reply to
In Reply To:
Also, has the add function in PHP been tested much with extra fields? I'mgetting some weird problems with it which I cant seem to work out. If someonesubmits a listing with all the default fields, it works fine and you get thesubmission success page. However, if there are extra fields it just takes youback to the add page.

Hmm... what software are you using (httpd, db, os, etc)? I just tried adding an extra text field to my db here, and added a new link w/o any problems. Looking at CVS, there doesn't seem to be any major changes to the Add.inc.php.

In Reply To:
The even weirder thing is that $error does not actuallyhold an error, even though it must hold something as the following code is in mypage;

$error in that case would probably be the error passed back from the database. I'm assuming the new link doesn't get added.


Adrian
Quote Reply
Re: [RedRum] Rate... In reply to
It's done like that because all the templates are converted from the regular default templates automatically. I wrote a script to do it since it's hard to keep both the default and default_php templates in sync, and so it makes it extremely easy to keep them up to date.



Adrian
Quote Reply
Re: [brewt] Rate... In reply to
Hi.I'm using MySQL, on Apache (not sure what version) and PHP 4. I'll haveanother go later, but if not I'll send you an email as to where a demo of theproblem is. I'll let you know how I go. BTW, do you always work on Sundays overthere? [;/]

Thanks

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [RedRum] Rate... In reply to
Quote:
<?if ($error) { ?>there was an error. It was <?print$error?><? } ?>

be better as:

<?if ($error) { echo "there was an error. It was $error"; } ?>

Yeah, it ould be. However, I am trying to simply keep to the same method of printing stuff as I have with the rest of the stuff. Otherwise when I go back later I may get confused Tongue (very easy btw)

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!