Jump to content

Trace7r

Members
  • Posts

    3
  • Joined

  • Last visited

About Trace7r

  • Birthday 05/07/1974

Previous Fields

  • Languages
    English, Dutch

Profile Information

  • Location
    Belgium

Trace7r's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. It seemed to be a syntax error just as I tought, the link to the PHP file had to start from the root up and most important of all, I did have to use the right ' or "... OK Shame on me, but I did look over it, so I hope will not struggle that long again over something silly like that... Justsomeguy thx for your help. Grtz Trace7r.
  2. This is a module in a Joomla website and the echo is shown in de position where the module is running in. I do know the "inspect element" screen if you right click on a website, but I don't know all the functionality, I did use firefox because it has a nice debug tool, but firefox doesn't work anymore on my PC. I usualy check my work in the browsers I installed (Chrome "standard", IE, Opera, Safari, Firefox (not anymore)). Did a new install of FF but still crashes, I have to admit that I didn't google for a solution yet on the FF problem but that's off-topic here :-) Strange thing is also that the code is copied from a previous module I made, so I think it has to be a syntax problem but I can't find it, it did work once, so I zipped the code again to reinstall it, so I would know all was working well. And then it didn't react anymore, the module does everything until I wanna get my data back out of the JS file to the PHP file. Did put alerts in the js so I did see the code running with all var filled as it should be but the echo's in the mail.php like: echo"Name = ".$Name; only showed "Name = " in the site position running the module. One thing I did struggle with is that the mail.php is in the main dir and the JS file is in a folder "JS" so the call for mail.php in the js-file should be like httpObjectMail.open("GET", "../mail.php?" So the Js file will search the mail.php file a level higher, I did not show that in the code above, because I didn't really think that would be the problem Greets Trace7r
  3. Ok i'm totaly new here, I play with some code when I have time for it... But I'm a little confused, it seems that the new ajax way is coded as $.ajax but that I don't understand yet, Because i'm adjusting some existing code I have to go from one php file to another over js the old way... So I have a php file where I echo a div with an input as type="text" and id="txtnameposition", in the same div I have a button who is calling the function closeandmail in the JS file. In the JS file I get de input of the textbox as: var jsName = document.getElementById("txtnameposition").value; When I put an alert(jsName); inside the JS file I do get the input value, so passing values from the first php file to the js file is no problem.... BUT, to send this all to the next PHP file I used next code in the JS file: function getHTTPObject(){var xhr = false;//set to false, so if it fails, do nothingif(window.XMLHttpRequest) {//detect to see if browser allows this methodvar xhr = new XMLHttpRequest();//set var the new request} else if(window.ActiveXObject) {//detect to see if browser allows this methodtry {var xhr = new ActiveXObject("Msxml2.XMLHTTP");//try this method first} catch(e) {//if it fails move onto the nexttry {var xhr = new ActiveXObject("Microsoft.XMLHTTP");//try this method next} catch(e) {//if that also fails return false.xhr = false;}}}return xhr;//return the value of xhr}function closeandmail(){var jsName = document.getElementById("txtnameposition").value;httpObjectMail = getHTTPObject();if (httpObjectMail !== null) {httpObjectMail.open("GET", "mail.php?"+ "Name=" + jsName);httpObjectMail.send(null);}httpObjectMail = null;} And in the second PHP file I put next code: $Name = $_GET['Name']; echo 'Name = '.$Name;$MailMessage = 'The name = '.$Name;$to = 'mail@mail.com';$subject = 'The name = '.$Name;$headers = 'From: mail@mail.com'.'rn'.'X-Mailer: PHP/' . phpversion();mail($to, $subject, $MailMessage, $headers); The echo only shows "Name = " and no value, so can someone please tell me what is wrong in this code? because I did try a lot of things but it didn't work so far. Greetings Trace7r.
  4. pro-gramming or something like that

  5. Sorry, my mistake, i have to be validated

  6. why can I not create any topic?

×
×
  • Create New...