CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    Feb 2008
    Posts
    4

    mysql query submitted without onclick

    Hello,
    I thought this bit of Ajax was working perfectly.

    However, I just discovered that the mysql query in div ID "highslide-html-contactform1" gets executed without being clicked as long as the user is logged in (that is, if($my->id) is true).

    Is there any way to limit execution to only the "onclick" event.

    Many thanks,
    Patty



    PHP Code:
    <?
    $Request_Date=date("m-d-Y");
    $contact="literature";

    ?>
    Code:
    <a href="#" style =" font-size:14px; color:#B5404D; text-decoration:underline;" onclick="return hs.htmlExpand(this, { contentId: 'highslide-html-contactform1' } )" title="Request Information">&nbsp;RFI</a>
    <div id='highslide-html-contactform1' class="highslide-html-content" style="width: 350px">
    <div class="highslide-body">
    PHP Code:
    <?
    global $my;


    global $SERVER_NAME,$REQUEST, $_POST, $_GET,$SCRIPT_NAME,$QUERY_STRING;


    $server = mysql_connect($dbhost, $dbusername, $dbpass)or die(mysql_error());

    $server1 = mysql_connect($dbhost1, $dbusername1, $dbpass1);
    $connection = mysql_select_db($dbname, $server)or die("Can't connect to database1.");
    $connection1 = mysql_select_db($dbname1, $server1)or die("Can't connect to database2.");

    if (isset($_GET[action])){
    // Retrieve the GET parameters and executes the function

    foreach($_GET as $key => $value)
    {

    $$key=$value;
    }


    } else if (isset($_POST[action])){
    // Retrieve the POST parameters and executes the function

    foreach($_POST as $key => $value)
    {

    $$key=$value;
    }
    }
    $user=$my->id;
    $contact="contact";

    if($my->id) {


    $query = "SELECT .etc.. WHERE jos_users.id = $user";

    $res=mysql_query ($query) or die(mysql_error());
    while($row=mysql_fetch_array($res)){
    $name=$row["name"];
    $userid=$row["user_id"];
    $company=$row["company"];

    $address=$row["address"];
    $city=$row["city"];
    $state=$row["state"];
    $zipcode=$row["zipcode"];
    $phone=$row["phone"];
    $email=$row["email"];

    }



    $query1 = "insert into directory.requests (record, showid, userid,user_name,company,address, city, state, zip, phone, email, vendor_id, request,date) Values(NULL,'$showid','$userid', '$name','$company','$address', '$city','$state', '$zip', '$phone', '$email','$vendorid','$contact','$Request_Date') ";


    $result=mysql_query($query1) or die(mysql_error());
    $query2 = "select supplierName from vendor where supplierid = $vendorid";
    $res2=mysql_query ($query2) or die(mysql_error());
    while($row=mysql_fetch_array($res2)){
    $vendornamename=$row["supplierName"];
    }

    echo "Thank You for your request " . $my->name ." (" . $my->username . ").<br>";
    echo"<br>Your request for information has been submitted to $vendornamename";


    }
    else{
    echo"You must first log in (or register) in order to request information <BR>Use your  login on the right. No Account? <a href=\\">
    Register Now.</a>";
    }

    ?>
    Code:
    <div class="highslide-html-content-header">
    <div class="highslide-move" title="<?php echo $cd_login_lang_move; ?>">
    <a href="#" onclick="return hs.close(this)" class="control" title="close">close</a>
    
    
    </div>
    </div>
    </div>
    </div>
    <p></p>
    Last edited by pneb; February 14th, 2008 at 06:03 PM.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured