0 Members and 1 Guest are viewing this topic.

Need help again, formular select
« on: September 21, 2017, 08:24:08 AM »
Hi,
maybe the Post Title is diffus, but i need help because i am to stupid to make a sql query with a form select option.
ok, what i have?
a table named anzeigen_categories with following inserts
id, name
now i have a form with a dropdown menĂ¼ and user must select a categorie
if form is sending the php should insert the selected id into another table

in my php file i have following code:
$t->assign('anzeigen_categories', $osDB->getAll('SELECT * FROM !', array(ANZEIGEN_CATEGORIES_TABLE)));
in my template file i have follwing:
<dl>
                        <dt><label>Kategorie<font class="required_info">{$smarty.const.REQUIRED_INFO}</font></label></dt>
                        <dd>
                                <select class="form-control" name="category" REQUIRED >
                                        {foreach item=item key=key from=$anzeigen_categories}
                                               <option value="{$item.id}">{$item.name}</option>
                                        {/foreach}
                                </select>
                        </dd>
                </dl>

this works. if i open my php file url the user can select a category name.

but how can i now insert the selected value id in the other table? i mean not the sql insert, that works.
i need a variable with the selected option like
$catid = (this is what the user have selected)

hope you understand me
greetz

*

Pharg

  • *****
  • 3,153
    • OsDateFourm
  • osDate Version: osDateEvo v1.3
Re: Need help again, formular select
« Reply #1 on: September 21, 2017, 08:42:48 AM »
Hi lenzen24,

Sorry but I have no idea what that is and what it is for.
Regards,
Pharg ( Phill )

Don't Personal Message me unless it's about a sensitive matter!!

REMEMBER TO ALWAYS BACKUP BEFORE MAKING ANY CHANGES!!

osDateEvo v1.3 | PHP: 5.3.42 & PHP: 7.2 | MySQL: 5.5.35

Re: Need help again, formular select
« Reply #2 on: September 21, 2017, 08:46:11 AM »
sorry,
if you sit too long time on pc you get blind for simplest results
the simple result what i am looking for is : $catid = ($_POST['category']);

it works.
sorry for stupid question

Re: Need help again, formular select
« Reply #3 on: September 21, 2017, 08:47:54 AM »
@pharg

i am working on a simple ads script for my site.
just searching for security and a pic upload, then its ready to use

*

Pharg

  • *****
  • 3,153
    • OsDateFourm
  • osDate Version: osDateEvo v1.3
Re: Need help again, formular select
« Reply #4 on: September 21, 2017, 09:24:56 AM »
Hi lenzen24,

That would involve some custom work that's not part of osDateEvo, you might have more luck
hiring a coder or ask for help in some php dev forums sorry.
Regards,
Pharg ( Phill )

Don't Personal Message me unless it's about a sensitive matter!!

REMEMBER TO ALWAYS BACKUP BEFORE MAKING ANY CHANGES!!

osDateEvo v1.3 | PHP: 5.3.42 & PHP: 7.2 | MySQL: 5.5.35

Re: Need help again, formular select
« Reply #5 on: September 21, 2017, 02:06:15 PM »
It already works, but i'm not quite finished yet

*

Pharg

  • *****
  • 3,153
    • OsDateFourm
  • osDate Version: osDateEvo v1.3
Re: Need help again, formular select
« Reply #6 on: September 21, 2017, 10:27:36 PM »
Hi lenzen24,

Sounds interesting, hope to see it when it's finished then I can have a better idea what it does.
Regards,
Pharg ( Phill )

Don't Personal Message me unless it's about a sensitive matter!!

REMEMBER TO ALWAYS BACKUP BEFORE MAKING ANY CHANGES!!

osDateEvo v1.3 | PHP: 5.3.42 & PHP: 7.2 | MySQL: 5.5.35