Jump to content

reyes99

New Members
  • Posts

    9
  • Joined

  • Last visited

Posts posted by reyes99

  1. Hello all,

     

    I have this javascript that I am calling when I push a button. I want to load the popup programatically not by a button event.

     

    in popup.js I have the following function that loads the popup.

     

    //LOADING POPUP
    //Click the button event!
    $("#button").click(function(){
    //centering with css
    centerPopup();
    //load popup
    loadPopup();
    });
    

     

    My question is how do I load the popup from a php script by assigning a variable. for example

     

    <?php
    if ($loadpup = 'yes') {
    load the popup ( what command can I use that will activate the popup??)
    }
    ?>
    

     

    Thanks in advance

  2. Thank you for your quick response but I tested it with the $key and when I check any of the checkboxes and then click the Delete Button I always get :

    Array
    (
        [0] => on
        [1] => on
    )
    

    for example if I delete the second one I should get

    Array
    (
        [0] => on
        [2] => on
    )
    

    Right?  but I am getting 0 & 1

     

    Thanks again.

     

    Ralph

     

     

  3. Hi all,

     

    I have been trying to figure this out for a few days already and can't seem to figure it out. I want to display a few images with a checkbox next to it so I can delete multiple images at once when I press the delete button.

     

    My problem is that I can't seem to figure out how to check if the checkbox is checked. if I uncheck one of them and click the delete button it deletes one from the array but I don't know which one was unchecked. For example if I uncheck the second one the array shows:

     

    Array

    (

    [0] => on

    [1] => on

    )

     

    but I don't know which of the three was unchecked?

     

    Here is the code I have been testing with:

     

    <?php
    // if submit button is clicked
    if(isset($_POST['submit'])) {
    // do delete function();
    
    }
    // display deletethis[] array
    if (isset($_POST['deletethis'])) {
    echo "<pre>";
    print_r ($_POST['deletethis']);
    echo "</pre>";
    }
    
    $separate = array("http://funnypicturesimages.com/images/image/funny-dog-pictures.jpg", "http://1.bp.blogspot.com/-35wQMpYtNZc/TXWNx8y2xCI/AAAAAAAB_2o/9vZYNfWrGn8/s400/funny_demotivational_posters_01.jpg", "http://3.bp.blogspot.com/-TFnzZ8zFtgg/TXWNpodBkGI/AAAAAAAB_2Q/O_fOOSqFM6w/s400/funny_demotivational_posters_04.jpg");
    echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
    
    // display each image from array
    foreach ($separate as $value)
    {
    echo "<img src=".$value.">";
    if ($_POST['deletethis'] = "on") {
    $checked="checked";
    } else {
    $checked="";
    }
    
    if ($_POST['deletethis'] != "") {
    echo "checked"; } else{ echo "unchecked"; }
    
    // if checkbox currently checked display it checked else display unchecked
    if ($checked == "checked") {
    echo '<input type="checkbox" name="deletethis[]" checked="checked"/><br /><br />';
    } else {
    echo '<input type="checkbox" name="deletethis[]"/><br /><br />';
    }
    
    }
    ?>
    <center><input type="submit" name="submit" value="Delete Checked"></center>
    </form>
    

     

  4. That worked!!

     

    Thank you guys for your help. 

     

    xtopolis here is what I did to fix it from your example, I have been tryting to get this to work for a week!!

     

    <?php
       echo "<form id='form1' name='form1' method='post' action=''><p>
             <label><input type='text' name='memberid[]' value='memberid' /></label></p><p>
         <label><input type='text' name='memberid[]' value='memberid' /></label></p><p>
             <label><input type='submit' name='submit'  value='Submit' /></label></p>
             </form>";
    
    	 foreach($_POST['memberid'] as $value){
                echo "The value was $value<br />";
             }
    
    ?>

     

    Thank you Daniel0 for the tutorial I will go through it.

     

     

     

     

  5. Hi Everyone,

     

    I am having trouble figuring out how to store data from my form into an array and reading it.  This is what I have so far. 

     

    <?php
       echo "<form id='form1' name='form1' method='post' action=''><p>
             <label><input type='text' name='memberid[]' value='memberid' /></label></p><p>
         <label><input type='text' name='memberid[]' value='memberid' /></label></p><p>
             <label><input type='submit' name='submit'  value='Submit' /></label></p>
             </form>";
    
    	 $memberid = array("$memberid");
       echo "output = " . print_r("$memberid");
    ?>
       

     

    I get the following error:

     

    Notice: Undefined variable: memberid in C:\Program Files\EasyPHP 2.0b1\www\test.php on line 8

    Arrayoutput = 1

     

    Thanks

     

    Ralph

  6. I have the \r\n at the end of the line but in the comment field it is cutting it and adding multiple rows for each part where it cleans the field of "?" and ","'s.  Not sure what the problem is???

     

    cleancomm($row[14]) . "\r\n";

     

    I think the problem is when I strip it of all the ? and ,'s it just cuts it.  I would like to know how I can get the whold comment to stay together before the next line or row.

     

    Thanks

     

     

  7. Hi,

     

    I am new to PHP and I am lookig for more information on the formating strings for example \n\r

     

    I was trying to find them on google to read more about them but not sure what to search for.

     

    Could somone please tell me where I can find some more information on this.

     

    or maybe yo ucan help me with my issue.

     

    I created thsi function and I want to clean up a comment field from ? and ,s but I want it to continue the line.

    it is creating a new line when I try to convert it to an Excel .csv file.

     

    Thanks

     

     

     

    Here is my code:

    <center><h1><img border="0" src="banner.gif" width="805" height="70"></h1>

    <h1>Survey Results</h1></center>

     

    <?php

    function cleancomm($comm)

      {

        $comm1 = str_replace('?', ' ', $comm);

        $comm2 = str_replace(',', ' ', $comm1);

        return $comm2;

      }

     

    require 'config.php';

    require 'opendb.php';

     

    $fp = fopen('file.csv','wa');

    $q = 'select * from survey';

    $query = mysql_query($q);

    while ($row = mysql_fetch_array($query)) {

    $nextline = $row[0] . ',' . $row[1] . ',' . $row[2] . $row[3] . ',' . $row[4] . ',' . $row[5] . ',' . $row[6] . ',' . $row[7] . ',' .

                $row[8] . ',' . $row[9] . ',' . $row[10] . ',' . $row[11] . ','. $row[12] .',' . cleancomm($row[13]) . ',' . cleancomm($row[14]) . "\r\n";

     

     

     

    fwrite($fp,$nextline);

    }

    fclose($fp);

    ?>

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.