K
K
Konstantin Khairov2016-01-31 18:59:54
PHP
Konstantin Khairov, 2016-01-31 18:59:54

How to make a GET request accepted in the DLE additional field during registration?

Hello everyone, once again a problem with DLE, added an additional field "Who invited you" there when you enter a nickname in the database, the nickname of the inviter will be added. Everything works, but I want to auto-complete this form using a GET request. So that users use a link like . http://sitname.uz/index.php?do=register&ref=nickname
Yes, it would be more convenient. By poking around in the engine did not find a suitable one. In PHP I understand a little about this, I don’t need to explain it on my fingers. At least just advise in which direction to look or in which file. Thank you very much in advance .

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Murzin, 2016-02-11
@Atlant_T

It's probably better to solve the problem via javascript.

keys = {}; // создаем объект
mas = window.location.toString().split('?')[1].split(/\=|\&/); // Разбиваем GET
for (x = 0; x < mas.length; x +=2){
  keys[mas[x]] = mas[x+1]; // Вносим данные
}
/*
Теперь все переменные, которые пришли с запросом, хранятся у нас в объекте
Осталось внести в форму.
*/
function open_event(){ //Что бы не возникло проблем (если например скрипт встроенный)
document.getElementById("ref_form").innerHTML = keys.ref;
}
document.addEventListener("DOMContentLoaded", open_event); // используем событие построения DOM

Well, something like this.
PS: And it is possible and easier.
echo "<input type=\"text\" Value=\"".$_GET['ref']."\" size=\"40\">"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question