Jump to content

I get $_SESSION['x']['y'] in my input boxes where i should get values


rondelli.gabriel

Recommended Posts

see the images attached.

I tried using a javascript function to create html on the spot based on the option (radio button) selected by the client.

 

Heres the code

function showPersFizica(){

document.getElementById('formular').innerHTML = "

<table class=\"login\" cellspacing=\"30\" align=\"center\">

<tbody>

<tr>
<!-- Nume --><td class=\"right\" align=\"right\"><input type=\"text\" id='numeReq' name='numeReq' size=\"20\" value=\"<?php echo $_SESSION['values']['numeReq']?>\" onblur='validate(this.value, this.id)' tabindex=\"3\"  >

<br /><span id='numeReqFailed' class=\"<?php echo $_SESSION['errors']['numeReq'] ?>\">Completat Necorespunzator</span>

<!--Prenume-->

<input type=\"text\" id='prenumeReq' name='prenumeReq' size=\"20\" value=\"<?php echo $_SESSION['values']['prenumeReq'] ?>\" onblur= \"validate(this.value, this.id)\" tabindex=\"4\"><!-- Eroarea afisata daca campul nu este completat corespunzator -->

<br /><span id=\"prenumeReqFailed\" class=\"<?php echo $_SESSION['errors']['prenumeReq'] ?>\">Completat Necorespunzator</span></td>

<!-- Descrierea campului --><td id=\"def\">  Numele si Prenumele <span class=\"red\">*</span></td></tr><tr><!-- Numele de utilizator --><td class=\"right\" align=\"right\">

<input type=\"text\" id='numeUtilReq' name='numeUtilReq' size=\"20\" value=\"<?php echo $_SESSION['values']['numeUtilReq'] ?>\" onblur= \"validate(this.value, this.id)\" tabindex=\"5\"><!-- Eroarea cu pricina --><br />

<span id=\"numeUtilReqFailed\" class=\"<?php echo $_SESSION['errors']['numeUtilReq'] ?>\">Completat Necorespunzator sau Deja Inregistrat</span>

</td><!-- Definitia Campului --><td id=\"def\"> Nume de utilizator <span class=\"red\">*</span></td></tr>

<tr><!-- Parola --><td class=\"right\" align=\"right\">

<input type=\"password\" id='parola_req' name='parola_req' size=\"20\" value=\"<?php echo $_SESSION['values']['parola_req'] ?>\" onblur= \"validate(this.value, this.id)\" tabindex=\"6\" ><!-- Eroarea cu pricina --><br />

<span id=\"parola_reqFailed\" class=\"<?php echo $_SESSION['errors']['parola_req'] ?>\">Parola prea mica, min 10 char sau Inexistenta</span>

</td><!-- Definitia Campului--><td id=\"def\"> Parola de inregistrare <span class=\"red\">*</span></td></tr><tr><!-- Confirmarea Parolei --><td class=\"right\" align=\"right\">

<input type=\"password\" id='conf_parola_req' name='conf_parola_req' size=\"20\" value=\"<?php echo $_SESSION['values']['conf_parola_req'] ?>\" onblur= \"validate(this.value, this.id)\" tabindex=\"7\" ><!-- Eroarea cu pricina --><br />

<span id=\"conf_parola_reqFailed\" class=\"<?php echo $_SESSION['errors']['conf_parola_req'] ?>\">Parola trebuie sa fie aceiasi cu cea de mai sus</span>

<!-- Explicatia campului --><td id=\"def\"> Rescrieti parola de inregistrare <span class=\"red\">*</span></td></tr><tr><!-- Adresa de Email --><td align=\"right\">

<input type=\"text\" id='adr_e_mail_req' name='adr_e_mail_req' size=\"40\" value=\"<?php echo $_SESSION['values']['adr_e_mail_req'] ?>\" onblur= \"validate(this.value, this.id)\" tabindex=\"8\"><!-- Eroarea cu pricina --><br />

<span id=\"adr_e_mail_reqFailed\" class=\"<?php echo $_SESSION['errors']['adr_e_mail_req'] ?>\">Completat Necorespunzator sau Inexistenta</span>

<!--Explicatia Campului --></td><td id=\"def\"> Adresa de Email <span class=\"red\">*</span></td></tr><tr><!-- CNP --><td align=\"right\">

<input type=\"text\" id='CNP' name='CNP' size=\"13\" maxlength=\"13\" value=\"<?php echo $_SESSION['values']['CNP'] ?>\" onblur= \"validate(this.value, this.id)\" tabindex=\"9\" ><!-- Eroarea cu pricina --><br />

<span id=\"CNPFailed\" class=\"<?php echo $_SESSION['errors']['CNP'] ?>\">Cod Invalid</span>

</td><!-- Explicatia Campului --><td id=\"def\">Codul Numeric Personal <span class=\"red\">*</span></td></tr><tr><td colspan=\"2\" align=\"center\"><p>Date de Identificare</p><span class=\"def_priv\">(Campurile pot fi completate pe parcurs in functie de serviciile dorite)</span></td></tr><tr><!-- Adresa --><td align=\"right\">

<input type=\"text\" id='adresa' name='adresa' size=\"40\" maxlength=\"100\" value=\"<?php echo $_SESSION['values']['adresa'] ?>\" onblur= \"validate(this.value, this.id)\" tabindex=\"10\" ><!-- Eroarea cu pricina --><br />

<span id=\"adresaFailed\" class=\"<?php echo $_SESSION['errors']['adresa'] ?>\">Completat Necorespunzator Minim 10 Caractere</span></td>

<!-- Explicatia campului --><td id=\"def\">Adresa</td></tr><tr><!-- Checkbox Termeni si Conditii de Utilizare --><td align=\"center\" colspan=\"2\"> 

<input type=\"checkbox\" id='chkb_termes' name='chkb_termes'  onblur=\"validate(this.checked, this.id)\" <?php if($_SESSION['values']['chkb_termes']==\"on\") echo \"checked='checked' \"   ?> tabindex=\"11\"  />Am citit si sunt de acord cu <a href=\"\">Termenii si Conditile</a>Intentiamea.ro<!-- Eroarea cu Pricina -->

<br /><div id=\"chkb_termesFailed\" class=\"<?php echo $_SESSION['errors']['chkb_termes'] ?>\">Asigurati-va ca ati citit <u>Termenii si Conditiile</u> de utilizare</div></td></tr><tr><td colspan=\"3\" align=\"center\"><input type=\"submit\" name=\"inreg\" value=\"<< Inregsitrare >>\" id=\"buton\"  ></td></tr></tbody></table>";

So function ShowPersFizica() or ShowPersJuridica() is called on each radio button on the onClick event which generates (using the innerHTML property) HTML with the according <?php ?> tags.

Can you please tell me where it went wrong or how can I solve this?

Thank you

 

Later edit: the property innerHTML as you know requires the html string to be written on one single line, so thats why the bulk of code. I tried spacing it a little bit, it`s very straightforward if you follow the tags, I just can seem to find where the bug is.

 

code Tags

CODE tags

code taaaags

 

[attachment deleted by admin]

OK, thanks for the reply :)

My index.php file calls the perssona.js file in which the code above is from.

Also on the server my page is hosted php is enabled and to prove this, the same code above written as it is without the extra \" \" works.

 

Better, If I`m allowed to post a link to a temporary page in this topic and you have firebug you can see what I mean.

the address where the php file is hosted is:

 

http://intentiamea.ro/site%20intentie/inreg.php

 

notice, that when it loads it loads the right way...try using it a while without the submit button just complete it or not and hit tab...it`s build using ajax validation

 

after you click on the radio button the same should happen but for a different form created using the functions disscused above.

 

Again, thanks for the support and if I broke any rules regarding any external links, please let me know.

 

Later Edit: I`ve tried your advice bricktop, but instead of showing <?php echo $_SESSION['bla']['bla'] it`s showing simply $_SESSION['bla']['bla']

Archived

This topic is now archived and is closed to further replies.

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