Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
I

Ioannis_o5

@Ioannis_o5
About
Posts
6
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • AJAX & PHP
    I Ioannis_o5

    Hello I am back again (I went to bed that's why I didn't answer this - you see I am in time zone GMT +2 ). NOW I SEE WHAT YOUR PROBLEM IS : The value you receive in responseText you DON'T HAVE TO DISPLAY IT ! For instance you can 'say' :

    var result = XMLHttpRequestObject.responseText;
    if (result==1)
    document.getElementById(div).style.visibility='hidden';
    else
    // do something else

    A last comment regarding your project : Things that can/must be done AT SERVER put them in the php script, while those that need the user's update and response hndle them with Java after returning from AJAX. My wishes for success. I ll check my mail again in about 6 hours. If there anything else, send a message. Cheers

    Linux, Apache, MySQL, PHP help php tools tutorial question

  • AJAX & PHP
    I Ioannis_o5

    I will disappoint you : You can't do that BUT you need not do that ! Think of the php page as a black box which can ONLY return a return string to the requesting javascript. That is : the javascript via the URL "thinks" that it requests a page from the server. The requested page (php) is executed and with the echo (or the print) statement it can send back text. This text received can be anything you like - anything the php programmer has designed. And this text is received in the

    XMLHttpRequestObject.responseText

    . And this responseText IS THE ONLY VIEW that you can have from you AJAX request to the php : php variables are NOT visible / accessible by the javascript. If all you want is to do your job then why do you worry. Or is it just curiosity? Send a message if there's anything else I can give a hand. I wish you good luck.

    Linux, Apache, MySQL, PHP help php tools tutorial question

  • AJAX & PHP
    I Ioannis_o5

    I ve just written this little piece of code (interrupting my VB project development - dont bother I like it) :

    if (isset($_GET["email"])) // if the email var was passed
    {
    include('dbconn.php') // connect etc. to your mysql - i have this stuff in dbconn.php
    $query="select email,blabla,etc FROM MyTable WHERE email='".$_GET["email"]."'";
    $result=mysql_query($query) or die('0');
    if (mysql_num_rows($result)>0) // if at least one record with this email
    echo '1'; // then send 1
    else
    echo '0'; // else send 0
    mysql_free_result($result);
    }

    I you have questions be back. Anyway let me know : did this help ?

    Linux, Apache, MySQL, PHP help php tools tutorial question

  • AJAX & PHP
    I Ioannis_o5

    Hello again Bryant, I believe that your $one should be passed to the php page and the response must be the value of $one. This

    result.$one

    doent look 'nice' to me. For instance if there should be a variable in your php code called $one , if you don't follow my previous comment for an array then it could look like :

    $variable_name = $_GET["req"];
    if ($variable_name == "one")
    echo $one;
    /// etc.

    This means of course that your java line that creates the URL should be like :

    var url = "/cms/_sql/sendPassword.php?req=one"

    and then your script (above) changes to

    var result = XMLHttpRequestObject.responseText;
    if (result == '1')
    { somecodeHere;
    }

    I ll be glad to help more if I can

    Linux, Apache, MySQL, PHP help php tools tutorial question

  • AJAX & PHP
    I Ioannis_o5

    Although I am not sure that I can help you the way you put the question, I will try. I use a lot of Ajax and in my opinion i. you are close to the traditional way , ii . you could find other solutions. My comments : a. Your example seems to be OK. Of course it returns whatever you havae passed as email. Pls confirm that is is so. b. Do I understand that you want to pass THE NAME of a variable and receive a value OR IS IT you want the calling javascript to decide what to do and NOT the called PHP. c. Before you clear this II would suggest : Wht don't you store your values in the php script in arrays like this $name= "Napoleon"; $myphone = "199199"; $myvalues[]=array("name" => $name , "phone" => $myphone ); $value_of_param= $_GET["req"]; // req is in place of your email variable echo $myvalues[$value_of_param]; (I hope I have no typo errors)

    Linux, Apache, MySQL, PHP help php tools tutorial question

  • php basics
    I Ioannis_o5

    Let me contribute to solving your struggling : First, because all your php pages that access mysql must connect to the Db it is a wise tradition to create an include file [call it for instance "dbconn.php"] with the following content : ============================ ============================ [NOTE the "localhost" must change if the target DB is not on your system but on a Host] then whenever you create a new php script start with : "; echo 'Prod.Name='. $row["ProductName"]."
    "; } ======================= Good luck s4 - php is great remember ! ioannis_o5

    Linux, Apache, MySQL, PHP php database tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups