Forums

select a category in the "submit an article" form

tergra 28 Sep, 2008
Hi, πŸ˜€

I'm using the submitcontent form, which is really greatπŸ™‚
but I need to have each article writer to select a category as in the classical "submit an article" page from the Joomla Core. I tried many things (pasting the code from the "submit an article" page to my form, etc.), but none works.

I'm a beginner in PHP, but I tried to code myself. Maybe I took a wrong way right from the start, or maybe I've done a huge and obvious error. Anyway I think that won't be hard for you to find out!!!πŸ˜‰


So far I have something like this in the "Form HTML" part :
Choose a category : <div class="clear">
  <form action="" method="post" name="category" id="category">
  <label></label>
  <select name="category" id="category">
    <option>category1</option>
    <option>category2</option>
 <option>category3</option>
  </select>
  </form>
  </div>
and this in the "On Submit code - after sending email" part :
<?php
$category=$_POST['category'];
$goandfind_req= "SELECT id FROM jos_categories WHERE ".$category."= title";
$goandfind=mysql_query($goandfind_req);
 
$_POST['catid'] =  $goandfind;
$_POST['id'] = ' ';
$_POST['sectionid'] = '1';
$_POST['state'] = '0';
$_POST['created'] = date("Y-m-d H:i:s");
?>

Thanks a lot for helping me πŸ™‚
GreyHead 28 Sep, 2008
Hi tergra,

There are a couple of things that might be causing problems but one that surely is - please remove the <form> tag from the Form HTML, ChronoForms write sit own and two will cause problems.

Which version of Joomla are you using?

Bob
tergra 28 Sep, 2008
Thanks for answering me, I'm using J1.5πŸ™‚
What do you mean by "please remove the <form> tag from the Form HTML"? Where is that "form" tag?

Thanx a lot
Max_admin 28 Sep, 2008
Hi tergra,

those are the form tags :

<form action="" method="post" name="category" id="category">
and
</form>


other issue, use directly this code in your form and remove the SQL you have :

<select name="catid">
<option value="1">Category 1</option>
<option value="2">Category 2</option>
</select>


Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
crony 02 Oct, 2008
Hello !

So it can be this as well :
<?php
$category=$_POST['catid'];
$_POST['id'] = '';
$_POST['sectionid'] = '8';
$_POST['state'] = '1';
$_POST['created'] = date("Y-m-d H:i:s");
?>


Works perfect for meπŸ™‚

Just need to understand a bit more the component, but it seems this is what I desperatly needed...
Just a question : can I edit again the form thru front office ? (not as an article, but as the original posted form ? )

You rocks !πŸ˜€
Max_admin 02 Oct, 2008
Hi crony,

you even don't need this line :

$category=$_POST['catid'];


that's if you will use my dropdown code above.

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
tergra 20 Oct, 2008
Ok, thanks a lot, I will try this as soon as I can. πŸ˜€
This topic is locked and no more replies can be posted.