php using variable as actual argument in php function -
Below is my code. In the first half of my code you will see variable $ $ question and $ line. I get the value when I echo out the $ Question and / or $ line [0]. However, at the bottom of the code, I try to use the variable in the add_textbox function as the actual argument for the use of these I am However, the add_textbox function is functioning as they are variable nulls. Someone can tell me what I am doing.
& lt ;? Php $ dbhost = 'localhost'; $ Uname = $ _POST ["uname"]; // *** Connection object $ connection = mysql_connect ($ dbhost, "bc572482", "dfdfdfs") or die (mysql_error ()); $ Dbname = "bc57"; Mysql_select_db ($ dbname) or die (mysql_error ()); // *** Select a random security question
// session_start (session) requires session variants; // resonance ($ _SESSION ["legitimate user"]. ''
;); $ Uname = $ _ session ["legitimate user"]; // resonance ($ uname. '& Lt; br & gt;'); $ rq = array ('q1', 'q2', 'q3'); $ Rand_key = array_rand ($ rq, 1); // resonance $ rq [$ rand_key]; $ Question = $ rq [$ rand_key]; $ Qtoanswer = mysql_query ("Choose $ FAQ from user where uname = '$ uname'"); If (! $ Qtoanswer) {echo "query could not be run:" mysql_error (); Go out; } // echo ($ qtoanswer. '
'); $ Line = mysql_fetch_row ($ qtoanswer); // resonance ($ line [0]. Abc); display_security (); // To create myprint ($ text) for the Job Security page function {Print ("$ text \ n"); } // *** style function a bit (of add_style) {myprint ( "& lt; link rel = \" stylesheet \ "type = \" text / css \ "href = \" main.css \ "/ & gt ; "); // Mimperint ("& style; type = text / css> * {font-family: arial;} h3 {color: orange} "); } // *** Add a text box function add_textbox ($ label, $ name) {myprint ("$ label
> "); } Function add_submit ($ label) {myprint ("& lt; input type = submit name = submit value = $ label & gt;"); MyPrints ("& lt; Input Type = Reset Price = Reset> gt; & lt; br & gt;"); } // dynamic security page function display_security () {myprint ("& lt; html> "); Add_style (); myprint ("& lt; / head> gt; body & gt;"); Micrint ("& lt; h3> Feeding our brothers and sisters and & lt; br & gt; Security check ";); // Security Form My Printer ("& lt; form name = security form method = post action = login.php>") has been created; add_textbox ($ line [0], $ question); add_submit ("login"); Myprint ("& lt; / form & gt;"); myprint ("& lt; / body> "); } ? & Gt;
pass $ line [0] and $ question function_security () function as code> function parameter display_security ($ row) [0], $ question); Use display_security () parameter variable in $ p & amp; $ query function display_security ($ p, $ query) {myprint ( "& lt; html & gt; & lt; head & gt;"); Add_style (); myprint ("& lt; / head> gt; body & gt;"); Micrint ("& lt; h3> Feeding our brothers and sisters and & lt; br & gt; Security check ";); // Security Form My Print ("
Comments
Post a Comment