Gossamer Forum
Home : Products : Links 2.0 : Installation -- Unix :

Adding to a selected category produces error

Quote Reply
Adding to a selected category produces error
If I have my 'Submit a Site' linked as such - <A HREF="$build_add_url">Submit a Site</A> - no problems, other than that it doesn't select the category you submitted from.

If I change it to - <A HREF="$build_add_url?Cat=$category_name">Submit a Site</A> - add.cgi doesn't display the add page/form and goes directly to the add_url_error page as if I'd pressed the 'Submit' button.

Here's the add url form details from site_html.pl:

Quote:
sub site_html_add_form {
# --------------------------------------------------------
# This routine determines how the add form page will look like.
#

my $category = shift;
if ($category) {
($category =
qq~$category<input type=hidden name="Category" value="$category">~);
}
else {
if (!@exclude_categories) {
($category = &build_select_field ("Category"));
}
else {
($category = &get_cat_select_list);
}
}

&html_print_headers;
{ print qq~
<html>
<head>

details about adding a site, etc. and here's the add form ...

<FORM ACTION="$build_add_url" METHOD="POST">

<table border ="0" cellspacing="0" cellpadding="3">
<tr><td height=22 align="right" valign="absmiddle"><FONT SIZE=2 COLOR="#000000" FACE="VERDANA,ARIAL">Site Title:</td>
<td height=22 valign="absmiddle"><FONT SIZE=3 COLOR="#000000" FACE="VERDANA,ARIAL"><input name="Title" value="$in{'Title'}" size="30"></td></tr>
<tr><td height=22 align="right" valign="absmiddle"><FONT SIZE=2 COLOR="#000000" FACE="VERDANA,ARIAL">Site URL:</td>
<td height=22 valign="absmiddle"><FONT SIZE=3 COLOR="#000000" FACE="VERDANA,ARIAL"><input name="URL" value="$in{'URL'}" size="30"></td></tr>
<tr><td height=22 align="right" valign="absmiddle"><FONT SIZE=2 COLOR="#000000" FACE="VERDANA,ARIAL">Category:</td>
<td height=22 valign="absmiddle"><FONT SIZE=2 COLOR="#000000" FACE="VERDANA,ARIAL">~; $db_select_fields{'Category'} = join (",", &category_list); print &get_cat_select_list ("Category", "$in{'Category'}"); print qq~</td></tr>
<tr><td height=22 align="right" valign="absmiddle"><FONT SIZE=2 COLOR="#000000" FACE="VERDANA,ARIAL">Short Description:</td>
<td height=22 valign="absmiddle"><FONT SIZE=3 COLOR="#000000" FACE="VERDANA,ARIAL"><textarea wrap="virtual" name="Description" value="$in{'Description'}" rows="2" cols="32">$in{'Description'}</textarea></td></tr>
<tr><td height=22 align="right" valign="absmiddle"><FONT SIZE=2 COLOR="#000000" FACE="VERDANA,ARIAL">Keywords:</td>
<td height=22 valign="absmiddle"><FONT SIZE=3 COLOR="#000000" FACE="VERDANA,ARIAL"><input name="Keywords" value="$in{'Keywords'}" size="30" MAXLENGTH="50"></td></tr>
<tr><td height=22 align="right" valign="absmiddle"><FONT SIZE=2 COLOR="#000000" FACE="VERDANA,ARIAL">Contact Name:</td>
<td height=22 valign="absmiddle"><FONT SIZE=3 COLOR="#000000" FACE="VERDANA,ARIAL"><input name="Contact Name" value="$in{'Contact Name'}" size="30"></td></tr>
<tr><td height=22 align="right" valign="absmiddle"><FONT SIZE=2 COLOR="#000000" FACE="VERDANA,ARIAL">Contact Email:</td>
<td height=22 valign="absmiddle"><FONT SIZE=3 COLOR="#000000" FACE="VERDANA,ARIAL"><input name="Contact Email" value="$in{'Contact Email'}" size="30"></td></tr>
<tr><td height=22 valign="absmiddle"></td><td height=22 valign="absmiddle"><FONT SIZE=2 COLOR="#000000" FACE="VERDANA,ARIAL"><input type="SUBMIT" name="add_record" value="Add Resource"></td></tr>
</table>
</form>

Can anyone help from this or will you need the add.cgi details?

All the best
Shaun
Quote Reply
Re: Adding to a selected category produces error In reply to
Change the following codes:

Code:
<td height=22 valign="absmiddle"><FONT SIZE=2 COLOR="#000000" FACE="VERDANA,ARIAL">~;
$db_select_fields{'Category'} = join (",", &category_list); print &get_cat_select_list ("Category",
"$in{'Category'}"); print qq~</td></tr>

to the following:

Code:
<td height=22 valign="absmiddle"><FONT SIZE=2 COLOR="#000000" FACE="VERDANA,ARIAL">$category</td></tr>

You have already defined what that variable will do above in the following section of codes:

Code:
my $category = shift;
if ($category) {
($category =
qq~$category<input type=hidden name="Category" value="$category">~);
}
else {
if (!@exclude_categories) {
($category = &build_select_field ("Category"));
}
else {
($category = &get_cat_select_list);
}
}

Hope this helps.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
http://www.anthrotech.com
Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
----------------------





Quote Reply
Re: Adding to a selected category produces error In reply to
Eliot,

I'm still getting similar behavour, it goes straight to the 'Add Error' form and at the top of the form reports the following error:

400 URL missing

Oh - hang on - I've just changed the URL for submitting a site, it was:

Quote:
<A HREF="$build_add_url?Cat=$category_name">Submit a Site</A>

I removed the Cat=$category_name and that fixed it Smile

Thanks
------------------
Shaun Hague
Webmaster - Qango.com
www.qango.com/central/

[This message has been edited by qango (edited January 22, 2000).]
Quote Reply
Re: Adding to a selected category produces error In reply to
RIGHT!!!!!!!!!

And the codes I gave are the correct codes to use!

You can not use arguments in the add.cgi, modify.cgi or rate.cgi like you are trying to do!

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
http://www.anthrotech.com
Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
----------------------