vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Passing Variables through Form (https://vborg.vbsupport.ru/showthread.php?t=125093)

Kirk Y 08-27-2006 07:15 PM

Passing Variables through Form
 
Okay, I've got a form with yes/no buttons. To access this form I use misc.php?do=unsubscribe&id=1, where id=1 is the userid being unsubscribed. Now, after the user chooses to continue and unsubscribe, I need to remove their subscription using their userid. My problem is that after the user continues, the &id=1 variable is lost -- so the query cannot run. How can I get the &id=1 to pass along?

Adrian Schneider 08-27-2006 07:31 PM

PHP Code:

// vBulletin?
$userid $vbulletin->input->clean_gpc('g''id'TYPE_UINT);

// not vBulletin?
$userid = !empty($_GET['id']) ? intval($_GET['id']) : 0

HTML Code:

<input type="hidden" name="userid" value="$userid" />

Kirk Y 08-27-2006 08:26 PM

It's still not continuing along.

Adrian Schneider 08-28-2006 05:15 AM

It will send it with your form data...

Kirk Y 08-28-2006 06:24 PM

So I should be able to use $userid as it continues to the dounsubscribe page, right?

Adrian Schneider 08-28-2006 06:27 PM

$_GET['userid'] or $_POST['userid'], depending on your form method.

Kirk Y 08-28-2006 06:34 PM

Oh, I thought I used the cleaned variable.

Adrian Schneider 08-28-2006 06:38 PM

You should clean it... just as you clean the other data coming from the form.

$userid is just ?id=X being generated into the form HTML. From there on it's just a regular form element.

Kirk Y 08-28-2006 06:39 PM

Yeah I realize that, but the code you provided cleaned it -- that's what I'm using.


All times are GMT. The time now is 06:30 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01222 seconds
  • Memory Usage 1,723KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete