Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 11-16-2006, 09:02 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Echoing A Variable?

Im doing something very basic and Im stumped for whatever reason.

Basically in the showthread template I have a text line called

<input type="text" name="testme" value="$testme" size="12">

When I click the perform action button it should echo whats in the variable "a.k.a" a string.

In postings.php Im trying to echo $testme;

No luck. Make sense?
Reply With Quote
  #2  
Old 11-16-2006, 09:20 PM
Antivirus's Avatar
Antivirus Antivirus is offline
 
Join Date: Sep 2004
Location: Black Lagoon
Posts: 1,090
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i think you need to place your var within "" like

Code:
echo "$testme";
Reply With Quote
  #3  
Old 11-16-2006, 10:27 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

naw that didnt work either. Hmm...


In postings.php I have


PHP Code:
if ($_POST['do'] == 'test')
{
echo 
"$testme";

in the showthread template I have:

PHP Code:
<div><label for="ao_cct"><input type="radio" name="do" id="ao_cct" value="outputit" />OutPut It!</label></div>

<
input type="text" name="testme" value="$testmesize="12"
That code is right beneath all the other admin functions like Split Thread, Move Thread, etc. So when you hit Perform action, it should post that variable back.


I'm not even sure if Im doing this right...



Ok I did a
PHP Code:
if (isset($testme)) {    
echo 
"$testme";
}
else {
echo 
"crap";

and I saw the word crap, which means the variable isnt being passed or SET
Reply With Quote
  #4  
Old 11-17-2006, 06:42 PM
Guest190829
Guest
 
Posts: n/a
Default

Where are you setting $testme?
Reply With Quote
  #5  
Old 11-17-2006, 06:48 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

in a text box, value="$testme"

and the text box is actually under one of the radio buttons in the threadadmin manage. see below
Attached Images
File Type: gif screen10.gif (6.0 KB, 0 views)
Reply With Quote
  #6  
Old 11-17-2006, 06:52 PM
Guest190829
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by paul41598 View Post
in a text box, value="$testme"

and the text box is actually under one of the radio buttons in the threadadmin manage. see below
The variable will be in the $_POST array, but you would use vBulletin's built in sanitizing array:

PHP Code:
$vbulletin->input->clean_gpc('p''testme'TYPE_NOHTML)); 
The new variable would be:

PHP Code:
$vbulletin->GPC['testme'
Reply With Quote
  #7  
Old 11-17-2006, 07:03 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

wow that worked! Thankyou so much, I'm sure I'll have more questions later to be asked now that I got past this part. Thanks again Danny

what about a checkbox variable sir? How do I pass that on?
Reply With Quote
  #8  
Old 11-17-2006, 07:39 PM
Guest190829
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by paul41598 View Post
wow that worked! Thankyou so much, I'm sure I'll have more questions later to be asked now that I got past this part. Thanks again Danny

what about a checkbox variable sir? How do I pass that on?
Checkboxes are held in arrays so it would be something like:

HTML Code:
<input type="checkbox" name="options[]" value="x">

<input type="checkbox" name="options[]" value="y">

<input type="checkbox" name="options[]" value="y">
The php code would be:

PHP Code:
$vbulletin->input->clean_gpc('p''options'TYPE_ARRAY)); 
And $vbulletin->GPC['options'] would be an array of all the values that were checked.
Reply With Quote
  #9  
Old 11-17-2006, 08:12 PM
paul41598's Avatar
paul41598 paul41598 is offline
 
Join Date: Jun 2004
Location: MI
Posts: 732
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Danny, seems to be working so far!
Reply With Quote
  #10  
Old 11-17-2006, 08:45 PM
Guest190829
Guest
 
Posts: n/a
Default

I'm glad everything is working. Get into the habit of sanitizing all of your variables, as it is a security risk if you don't.

If you need more information on it, there is documentation inside the file at

includes/class_core.php

Reply With Quote
Reply

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 08:13 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.04273 seconds
  • Memory Usage 2,275KB
  • 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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_html
  • (6)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (6)postbit_onlinestatus
  • (10)postbit_wrapper
  • (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_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • 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
  • 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
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete