vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Passing data between PHP and MySQL database? (https://vborg.vbsupport.ru/showthread.php?t=67066)

MacMorag 07-11-2004 02:34 PM

Passing data between PHP and MySQL database?
 
I have added a drop-down menu to the reply form, which has three options - "A", "B" and "C". Whenever someone replies they must select either of the three options.

I have also created a new field in the "post" table in the database. This field is called "option", and is used to record whether A, B or C was selected when the post was submitted.

How do I pass the selected option from the reply form and place it in the "option" field in the database.

e.g. When the post is submitted by the user, they select option A. How do I place "A" in the "post"table of the database.

Thanks.

AN-net 07-11-2004 03:00 PM

edit /includes/functions_newpost.php

MacMorag 07-11-2004 04:31 PM

Thanks AN-net

MacMorag 07-12-2004 12:14 AM

Still stuck here :ermm:

What do I need to add to /includes/functions_newpost.php to get the selected option written to the database?

The drop down menu on the form has name = "option" and can have a selected value of "A", "B" or "C". How do I get $post[option] to contain the selected value? I'm guessing that it should be something along the lines of:

$post[option] = val(option) - i.e. $post[option] contains the value of "option" passed from the form.

I'm starting php from scratch here, so apologies for what seems like a fairly elementary question.

MacMorag 07-12-2004 01:02 AM

Sorted :)

If anyone else wants to know - use the $_POST variable which is automatically set by PHP when it encounters a form.


All times are GMT. The time now is 02:11 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.01137 seconds
  • Memory Usage 1,708KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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