Results 1 to 8 of 8

Thread: Fairly Non-Difficult PHP Question...

  1. #1
    Join Date
    Apr 2008

    Fairly Non-Difficult PHP Question...

    I have a webform on my Page with that has the ability to upload a File. It also collects a bit of information, including a value for "Platform", a value for "Game", and a value for "Guide Type". When the webform is submitted, it passes it into Moderation to be approved. Once it's approved, it creates a page much like this:


    Or this:


    All I need to do is add something into the <title> tag on "guide-details.php" so that it will display some of the <form> data that was entered. Can someone step me through this?

  2. #2
    Join Date
    Jul 2013
    Voorheesville NY USA
    Not without seeing some of the code. It really shouldn't be that hard as you say. Although if you want to "show" some info about the selection of data, wouldn't it be better to make it part of the heading on the page itself since the title area is limited by browser type and window size?

  3. #3
    Join Date
    Apr 2008
    I can't just go into "guide-details.php" and change the <title> tag because then it's just going to show that specific wording on every page.

    I need to retrieve the form data to be displayed in the <title> of the webpage because each page is going to have something different when the file is uploaded and approved. This is the <form>

    HTML Code:
    <table width="800">
                	<td width="225">Choose Platform : </td>
                    <select name="plateform" id="plateform" style="margin-bottom:15px; height:30px; width:200px;" onchange="getcat(this.value);" >
                    <option value="">Choose Platform</option>
                    <?php while($data1=mysql_fetch_assoc($rs1)){ ?>
                    <option value="<?php echo $data1['id'];?>"><?php echo $data1['name'];?></option>
                    <?php }?>
                	<td width="225">Choose Category : </td>
                    <select name="category" id="cat123" style="margin-bottom:15px; height:30px; width:200px;" onchange="getgame(this.value);" >
                    <option value="">Select Platform First</option>
                	<td width="225">Choose Game :<br />
                	  <a href="/submitgame.php"><em>(Not Listed?)</em></a><em></em></td>
                    <select name="game" id="game123" style="margin-bottom:15px; height:30px; width:200px;" >
                    <option value="">Select Category First</option>
                	<td width="225">Guide Type : </td>
                   <input type="text" id="guidetitle" name="guidetitle"  />
                	<td width="225">Upload Text File : </td>
                   <input type="file" id="filename" name="guide"  />
                	<td width="100">&nbsp;</td>
                	<td><input class="button" name="submit" type="submit" value="Upload"></td>

  4. #4
    Join Date
    Jul 2013
    Voorheesville NY USA
    I understand what you want to do. I just think that you should do it with a <p> tag at the top of the page instead of in the (as I said) limited <title> area. Doing it is up to you and your php skills.

  5. #5
    Join Date
    Apr 2008
    My PHP Skills are pretty basic at best. I'm probably only familiar with a couple of different uses..

    If you look at this Forum for example, when you switch from one page to another, the heading in the <title> tag changes from thread to threat. That's all I'm trying to do, but I'm not sure how to do that...

  6. #6
    Join Date
    Aug 2004
    First of all, you have to know where the desired data can be accessed. Will it be in the $_POST (or $_GET) array as submitted by the form, in $_SESSION, or do you have to pull it from the database? If we assume for the moment that it's in $_POST, it could simply be something like:
    PHP Code:
    <!DOCTYPE html>
    if(!empty($_POST['some_field_name'])) {
    else {
    "Default value if nothing submitted"
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  7. #7
    Join Date
    Jun 2007
    I'm a bit confused, once it passes moderation and all nothing is really coming from the form anymore, is it? Aren't you really looking at how to get that data from wherever it is being stored in the database and putting it into the title?

  8. #8
    Join Date
    Jul 2013
    Voorheesville NY USA
    Don't know what your ref to moderation is all about....

    php is simply a tool to (in your case) collect data and paste it into some html in order to format it on a client's screen. You need to locate where the data is being received in the script, learn how to extract the elements of it that you want to write out and then put some html around them and output them at the right moment amidst all the other output being sent. YOU want to do it as a title tag - fine. Just wrap it in the tags and place it. OTOH - I think it will look better as part of a page header since the title area of a window can be limited. In that case you would wrap it in a <p> or h2 or h3 tag and place it at the top of the body element.

    PS - the better way IMO is to do all the data extraction and formatting of it by storing it in a php variable. Then in your display portion of your script place that variable where you want the data to appear. Saves on tags and confusion by not mingling presentation and content prep. Ex. - build the data into a php var named "$my_title_data" and then down where you actually output the title tag simply put "<title><?php $my_title_data ?></title>".

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.13522 seconds
  • Memory Usage 2,935KB
  • Queries Executed 15 (?)
More Information
Template Usage (34):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_html
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (8)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (72):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates