Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
Prev Previous Post   Next Post Next
  #1  
Old 02-07-2006, 07:56 PM
Rich's Avatar
Rich Rich is offline
 
Join Date: Mar 2004
Location: U.S.A
Posts: 921
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Need assistance with form creation in the ACP

Hello,

(This is a double post because it classifies as both a mySQL question as well as a modification question. If one forum is better suited for this question over the other, I would appreciate it if a moderator would merge the 2 posts in the appropriate forum.)

I have been racking my brain on this for 3 days now and have tried numerous techniques to get this to work. I AM new to mySQL queries, so I know to you seasoned coders this is going to seem very remedial.

I have a table I created. This is the content and how I installed it:

CREATE TABLE this_data
(
site_name varchar(50),
site_url varchar(50),
admin_email varchar(50),
home_it int
);

I want to make a form in the acp that allows me to enter the values for these columns. If they exist already, they will be dropped and the new value inserted.

The output of these values will not be displayed. Instead, they will be placed in a settings file as variables like this (not sure if this is even correct!):

PHP Code:
<?php
$site_name 
$DB_site->query("SELECT site_name from this_data");
$site_url $DB_site->query("SELECT site_url from this_data");
$admin_email $DB_site->query("SELECT admin_email from aws_data");
$home_it = = $DB_site->query("SELECT home_it from this_data");
?>
I have gone through the adminfunctions.php file and that is just confusing me even more.

I know I want to create something like this:

PHP Code:
// ## Add Settings ##
//this would actually be: settings_admin.php?do=add

if ($_REQUEST['do'] == 'add')
{

    
$vbulletin->input->clean_array_gpc('p', array(
        
'site_name'    => TYPE_STR,
        
'site_url' => TYPE_STR,
        
'admin_email'    => TYPE_STR,
        
'home_it'    => TYPE_INT
    
));
    if (empty(
$vbulletin->GPC['site_name']) or empty($vbulletin->GPC['site_url']) or empty($vbulletin->GPC['admin_email']) or empty($vbulletin->GPC['home_it']))
    {
        
print_stop_message('invalid_settings_specified');
    }

    
/*Start Query*/
    
$db->query_write("
        INSERT INTO " 
TABLE_PREFIX "this_data
            (site_name, site_url, admin_email, home_it)
        VALUES
            ('" 
$db->escape_string($vbulletin->GPC['site_name']) . "', '" $db->escape_string($vbulletin->GPC['site_url']) . "', '" $db->escape_string($vbulletin->GPC['admin_email']) . "', '" $db->escape_string($vbulletin->GPC['home_it']) . "')
    "
);

    
define('CP_REDIRECT''settings_admin.php?do=manage');
    
print_stop_message('saved_settings_successfully'$vbulletin->GPC['settings']);

Now I know I have SOME things correct, or at least I think I do!

I just want to be able to see a form with the fields there to add the values. When "submit" is hit, I want it to save that info in the database. If that info exists, I want the new info to replace it.

I would greatly appreciate some help with this. I am really trying to learn how to do all of this but I don't/can't grasp it and I hope with some guidance I will be better capable.

(Please don't post anything like "check out how other people did it, or read this site, etc.) I have been viewing how others have done it and I have been reading so many tutorials on VB and mySQL in general that my eyeballs want to explode. I am just at a point where i am utterly confused and frustrated.

I am a pupil awaiting a teacher. I am showing some initiative here, so help me! lol
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:42 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03566 seconds
  • Memory Usage 2,365KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete