Jump to content

dk4210

Members
  • Posts

    154
  • Joined

  • Last visited

Posts posted by dk4210

  1. Hello Guys,

     

    I am trying to get this js to work with my PHP form and I need some help..

     

    I have the following form

     

    echo'
    <form id="form" name="form" method="post" action="index.php?content=listings&cid='.$cid2.'&id='. $id2 . '&contact=1" onsubmit="demo12">
    <label>
    <span class="small">Name</span>
    </label>
    <input type="text" name="name" id="name" class="validate(required)" value="'.$_SESSION['fname'] .' '.$_SESSION['lname'] .'" />
    
    <label>
    <span class="small">Email Address</span>
    </label>
    <input type="text" name="email" id="email" class="validate(required,email)" value="'.$_SESSION['email'] .'" />
    
    <label>
    <span class="small">Comments</span>
    </label>
    <textarea id="conowntxtarea" class="validate(required) name="comments"></textarea><br />
    
    <button id="demo12" type="submit">Send to Owner</button>
    <div class="spam_warning">Warning: Spam or Harrassment will not be tolerated!</div>
    <div class="spacer"></div>
    
    </form>';
    
    

     

    And the following js code

    <script type="text/javascript">
    $(document).ready(function() { 
       $('#demo12').click(function() { 
           $.growlUI('Growl Notification', 'Have a nice day!'); 
       }); 
    }); 
    
    </script>

     

    I want to be able to submit the form and it activate the js script notification before it completes the form action url.. Could some one give me a hand with this?

     

    Thanks, Dan

     

     

  2. On more question for ya..

    Is there a way to construct a query to grab the date range about and combine it with another table for example if I had two tables

     

    Table A

    |id |listing_id| start_date | end_date|

     

     

    Table B

    | listing id | listing_name |

     

     

    What I would like to do is query table A for * with start and end date and get the id

     

    Create a second query to grab the listing name in table b

     

    Combine the query results  to show is the listing name in the csv file that I will be exporting...

     

    Did I lose you?

     

    Thanks for your help..

     

     

  3. Hello Guys,

     

    I have a question.. I am trying to query the data base for a specific date range but it's not displaying the correct date range..

     

    Here is my query

    SELECT * FROM report WHERE start_date AND end_date BETWEEN '2011-08-01 00:00:00' AND '2011-08-31 00:00:00'
    

     

    It seems to be loading all the rows not just the date rage specified above.. Please advise..

     

    Thanks, Dan

  4. Hello Guys,

     

    I am trying to get the the css to work but having a hard time with it and need some help..

     

    Here is the content lined up in fire fox.

     

    2011-08-22_1550.png

     

    Ad this is what it looks like in IE (See my issue)

    2011-08-22_1551.png

     

    Here is the code

     

    echo '<div class="listing"><img src="'.$listing_photo.'"><span class="listlink"><a href="index.php?content=subcats&id='. $listing_id.'">'.$listing_title2.'</a></span><br><span class="listbody">'.$listing_body2.'<span class="readmore"><a href="index.php?content=subcats&id='. $listing_id.'">  Read more</a></span>>>></div>';

     

    Here is the CSS

    .listing {
    width:560px;
    height:auto !important;
    margin: 0 auto;
    text-align: left
    }
    .listlink {
        float:left;
        margin-left: 10px;
        margin-top: 20px;
        position: absolute;
        text-decoration:underline;
    }
    
    .listbody {
    float: left;
        margin-left: 110px;
        margin-top: -30px;
        width:440px
    }
    
    .listingdiv{
    border-bottom: 2px dotted #9EABB5;
    color:#FFF;
    }
    

     

    Please advise how to fix this..

     

    Thanks for your help in advance..

    Dan

  5. OK Thorpe it's almost all working except one part

     

    It should only display the ads with the ad_pcat=$cid AND approved='1'

     

    How would I add that in the current code?

     

    I tried but received an error

     

    $result = mysql_query("SELECT * FROM ads LEFT JOIN ads_photo USING (ad_id);") or die("Sql error : " . mysql_error());
    
    //$result = mysql_query("SELECT * FROM ads WHERE ad_pcat=$cid2 AND approved='1'") or die("Sql error : " . mysql_error());
    
    while($row = mysql_fetch_assoc ($result)){
        $ad_id=$row["ad_id"];
        $ad_title = $row['ad_title'];
        $ad_photo = $row['ad_photos'];
        
      echo "This is the ad photo" . $ad_photo;
        
    	    
        echo "<img src=\"$ad_photo\">This is the ad_title ". $ad_title."ID-$ad_id"."<br>";
    
    

     

     

     

  6. Hello Guys,

     

    I am trying to do a some sort of join with a while loop and I am not sure how to do it..

     

     

    I have 2 tables "ads" and "ads_photo" and I would like to pull the following data out of the tables

     

    ad_id and ad_title from the "ads" table

     

    The ad_photos from the "ads_photo" table

     

    the "ad_photo table id has to match the id from the "ads" table

     

    Then i need to display a while loop.

     

    Here is what I have so far

     

    $result = mysql_query("SELECT * FROM ads WHERE ad_pcat=$cid2 AND approved='1'") or die("Sql error : " . mysql_error());
    
    while($row = mysql_fetch_assoc ($result)){
        $ad_id=$row["ad_id"];
        $ad_title = $row['ad_title'];
        
    	    
        echo "<img src=\"$ad_photo\">This is the ad_title". $ad_title."ID-$ad_id"."<br>";
    
    Please advise
    

  7. Hi WebStyles,

     

    I tried the following

     

    / multiple recipients
    $to = $email;
    
    //$from2 = "someonelse@".$url."";
    $from2 = $_SESSION['no_reply'];
    
    //echo "This is the from2" . $from2;
    //exit;
    
    
    // subject
    $subject2 = 'You have a new message from ' . $_SESSION['site_name'] .'';
    
    
    //begin of HTML message
        $message2 = 'You have a new message.<br>'; 
        $message2 .= 'From:  '. $username1; 
        $message2 .= '<br>Message Details'; 
        $message2 .= '<br><a href="'.$site_url .'">Log in to see the message</a>';
        $message2 .= '<br><br><br>';
        
       
       //end of message
        $headers  = "From:".$from2."\r\n"; 
        $headers .= "Content-type: text/html\r\n"; 
    
      // Mail it
      mail($to, $subject2, $message2, $headers);

     

    And it never sent the email at all

     

    chintansshah,

     

    I tried what told me to do and it just sent the default email address..

     

    The strange thing is if I manually add the address in there it works fine but if I try to use a variable it malfunctions in one way or another..

     

    Please advise

     

  8. Hello Guys,

     

    I have a strange issue that I am trying to figure out...

     

    I have a php mail script that I can't get the correct from email address to display in the email client

     

    Here is my code notice the $from2 var

     

    If I have this code -  $headers  = "From:'.$from2.'\r\n";

    I get a default email address

     

    If I add this code -  $headers  = "From:example@example.com\r\n";

    it works fine.

     

    // multiple recipients
    $to = $email;
    
    $from2 = $_SESSION['no_reply'];
    
    //echo "This is the from2" . $from2;
    //exit;
    
    
    // subject
    $subject2 = 'You have a new message from ' . $_SESSION['site_name'] .'';
    
    
    //begin of HTML message
        $message2 = 'You have a new message.<br>'; 
        $message2 .= 'From:  '. $username1; 
        $message2 .= '<br>Message Details'; 
        $message2 .= '<br><a href="'.$site_url .'">Log in to see the message</a>';
        $message2 .= '<br><br><br>';
        
       
       //end of message
        $headers  = "From:'.$from2.'\r\n";
        $headers .= "Content-type: text/html\r\n"; 
    
      // Mail it
      mail($to, $subject2, $message2, $headers);
    

     

    I did echo out the $form2 to make sure it had a value and it does..

     

    Please advise..

     

    Thanks, Dan

  9. Hello Guys,

     

    I have the following code

     

     foreach($ct->data as $key => $value){
    
    	if(!in_array($ct->data[$key][3],$arr_read_messages)){
    
    $ct->data[$key][3]='<a class="ezjax" href="view_message.php?id='.$ct->data[$key][0].'" class=”unread”>'.$ct->data[$key][3].'</a>';
    
    }else{
    
    $ct->data[$key][3]='<a class="ezjax" href="view_message.php?id='.$ct->data[$key][0].'">'.$ct->data[$key][3].'</a>';
    
    }

     

     

    and when I run the code I get the error message

    Warning: in_array() [function.in-array]: Wrong datatype for second argument in

     

    Any idea what the error message means?

     

     

  10. Thanks for the reply..

     

    I changed your code a little cause it was causing syntax errors and it still doesn't work.

     

    Here is the code that you gave me that has been modified.

     

    1. Added the following code

    foreach($ct->data as $key => $value){
       $ct->data[$key][3]='<a href=#" onclick="part2('.$ct->data[$key][0].');" href="javascript:void();">'.$ct->data[$key][3].'</a>';

     

    2. Added this is the header

    <script type="text/javascript">
    function part2(id) {
    var part2 = document.getElementById('part2');
       if ( part2.className == 'hidden' ) {
          part2.className = 'visible';
          document.getElementById('message').InnerHTML = 'This is the ID: '+id
       } else {
          part2.className = 'hidden';
       }
    }
    </script>
    

     

    3. Added this in the hidden div

    <span id=message></span>
    
    

     

    Still not displaying the id..

     

    Please advise..

     

  11. Hello Guys,

     

    I need some help here..

     

    I have a page that has a grid on it and I have a hidden div(below the grid). When the link is clicked inside the grid it opens the hidden div (With me so far?) using the following code for the link in the grid.

     

    foreach($ct->data as $key => $value){
       $ct->data[$key][3]='<a href=#" onclick="part2();" href="index.php?messages&id='.$ct->data[$key][0].'">'.$ct->data[$key][3].'</a>';

     

    Here is the JS to show the hidden div

     

    <script type="text/javascript">
    function part2() {
    var part2 = document.getElementById('part2');
    if ( part2.className == 'hidden' ) {
    part2.className = 'visible';
    } else {
    part2.className = 'hidden';
    }
    }
    </script> 

     

    The problem I have is its passing the id to the hidden div, but its also refreshing the page (Which is not cool when you have a hidden layer that opens.

     

    Here is the code for the hidden layer

     

    <div id="part1">
    <p>Messages</p>
    </div>
    
    <div id="part2" class="hidden">
    <p><a href=index.php?content=messages>close</a></p>';
    
    $id = $_GET['id'];
    
    echo "
    This is the id - $id
    </div>

     

     

    If I do it this way it wont reload the pages but it also wont pass the var

    foreach($ct->data as $key => $value){
       $ct->data[$key][3]='<a href=#" onclick="part2();" href="#&id='.$ct->data[$key][0].'">'.$ct->data[$key][3].'</a>';

     

    So looks like I need to pass the var through the onclick function or some js function but not sure how.. Any help would be appreciated..

     

    Thanks!

    Dan

     

     

     

     

×
×
  • 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.