Results 1 to 4 of 4

Thread: Need PHP HELP!!!!

  1. #1
    Join Date
    Jan 2003

    Question Need PHP HELP!!!!

    I have a select box that gets filled from a DB query and contains a list of email addresses. I allow the user to multi select email addresses and by way of javascript move the selected email addresses over to another select box.

    Now once they have their selected group of email addresses in the second box they hit submit and I process these email addresses. This is what I want.

    So how do I access these email addresses on the next page? I need all of the addresses from the second box that they moved over. I am using php on the server side and using the post method on the form. I tried accessing the select list via $HTTP_POST_VARS["editbox"] but it only lists one of the items. I thought that the post vars was setup like an array and I tried to access it like $HTTP_POST_VARS["editbox"][0] but this gave me the first letter of the one email address.

    Thank you for your time.

  2. #2
    Join Date
    Nov 2002
    Dartmoor [Holiday]
    I think you need to change the name of the listbox to have square brackets on the end, i.e. "editbox[]". This should indicate to PHP to turn it into an array.


  3. #3
    Join Date
    Jan 2003
    Thank you for the reply. You are the second person to suggest this so I think this is the right path.

    My problem is I am not very good with Javascript and when I change my code to have the "[]" after the name I assume I need to do the same where I reference it in my Javascript. Once I do this my what was working JS code to move the items from one list to the other stops working.

    Just for the heck of it I will post my code below...if you can (or have time) it would be great if you could point me in a direction as to how this name="editbox[]" effects my Javascript code or additional changes that need to be made so this array will work. The first edit box is populated by a MYSQL query (I spared you the query code, I tried to keep it short) I am excited that I am one step away from this working (it has been a week now). Again thank you for your time.

    My code :

    <script LANGUAGE=\"JavaScript\">

    <!--// -------------------------------------------------------------------
    // copySelectedOptions(select_object,select_object[,autosort(true/false)])
    // This function copies options between select boxes instead of
    // moving items. Duplicates in the target list are not allowed.
    // ------------------------------------------------------------------->
    function copySelectedOptions(from,to)
    var options = new Object();
    for (var i=0; i<to.options.length; i++)
    options[to.options[i].value] = to.options[i].text;
    for (var i=0; i<from.options.length; i++)
    var o = from.options[i];
    if (o.selected)
    if (options[o.value] == null || options[o.value] == \"undefined\" || options[o.value]!=o.text)
    to.options[to.options.length] = new Option( o.text, o.value, false, false);
    if ((arguments.length<3) || (arguments[2]==true))
    from.selectedIndex = -1;
    to.selectedIndex = -1;

    <!--// -------------------------------------------------------------------
    // removeSelectedOptions(select_object)
    // Remove all selected options from a list
    // (Thanks to Gene Ninestein)
    // ------------------------------------------------------------------->
    function removeSelectedOptions(from)
    for (var i=(from.options.length-1); i>=0; i--)
    var o=from.options[i];
    if (o.selected)
    from.options[i] = null;
    from.selectedIndex = -1;

    <!--this function is supposed to loop through and select all options on submit to post the vars I need.-->

    function White()
    var opt = document.vblocked.towhite.options;
    var j, len = opt.length;
    for (j = 0; j < len; j++)
    opt[j].selected = true;
    return true;


    <!--***************************************END OF JS Functions****************************-->

    <table width=100% cellspacing=0 cellpadding=0 border=0>
    <div><img src=../images/blocked_01.gif></div>
    <td width=100%>
    <div><img src=../images/endline.gif></div>

    <form name=vblocked method=\"POST\" action=\"../admin/clearblocked.php\" onSubmit=\"return White()\">

    <!--******irrelevant body info************-->
    <table cellpadding=3 cellspacing=5 border=0>
    All of the email addresses below have been sent an email
    of rejection that they must reply to for proof of legitimacy.
    Once they reply they will be added to SpamnIt's Database and
    be able to send you email. If you know someone in the list is
    legitimate or see a newsgroup/forum address,
    <b><a href=../admin/adminwhite.php>Click here</a></b> to add them to your
    Whitelist so you can immediately receive email from them.
    SpamnIt periodically cleans out these declined emails. If you would like
    to clear them sooner, check the <b>delete</b> box and click <b>Submit</b>
    to clear all declined email addresses from your list.<p>

    <table cellpadding=3 cellspacing=5 border=0>
    <b>Email Address</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <b>Date Declined</b>

    <!--******end of irrelevant body info************-->
    <td width=20>
    <select multiple name=blocked size=15 style=\"width:250;\">";

    //here we loop through our query results and build the list of
    //blocked email addresses and dates they were blocked.
    while ($row = @mysql_fetch_array($result))
    //here we query the declined table inside this loop for each address
    //to see if they are still in there meaning they have not
    //replied to the email that was sent to them. We do this
    //so we can display a different row color to the user to
    //show who has replied after being blocked and who has not.
    $query = "select UserID from declined where EmailFrom ='".$row[1]."'";

    $result2 = @mysql_query($query);

    $row1 = @mysql_fetch_array($result2);

    if (!empty($row1[0]))
    $value .='<Option style=color:red value ='.$row[1].'>'.$row[1]."&nbsp;&nbsp;&nbsp;".$row[2];
    $value .='<Option value ='.$row[1].'>'.$row[1]."&nbsp;&nbsp;&nbsp;".$row[2];

    //here we run a query to count the total of declined emails for a user a display
    $query = "select count(*) from blockedemails where UserID = ".$HTTP_SESSION_VARS["uid"];

    $result = mysql_query($query);

    $row = mysql_fetch_array($result);

    $value .= "</select>
    <a HREF=\"#\" onClick=\"copySelectedOptions(document.forms[0].blocked,document.forms[0].towhite,false);return false;\">Move to Whitelist&gt;&gt;</a><br><br>
    <select MULTIPLE NAME=\"towhite\" size=15 style=\"width:250;\">

    <a HREF=\"#\" onClick=\"removeSelectedOptions(document.forms[0].towhite); return false;\">Remove Selected Options</a>
    <td colspan=3>
    <span style=color:red>Emails in Red have not replied to the confirm email.</span>
    <b>Total Declined = ".$row[0]."</b>
    <td colspan=2>
    <b>Clear Declined List <input type=checkbox name=\"clear\">&nbsp;&nbsp;&nbsp;<input type=\"submit\" name=\"submit\" value=Submit>
    <p><b><a href=../main/acctmain.php>Return to main account menu</a></b>";

  4. #4
    Join Date
    Nov 2002
    Dartmoor [Holiday]
    This is a known problem. I'm afraid I don't have time to examine your code, but check out this article:



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.09659 seconds
  • Memory Usage 2,872KB
  • Queries Executed 13 (?)
More Information
Template Usage (32):
  • (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)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (4)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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 (70):
  • 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_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