Search the Community
Showing results for tags 'debugging'.
-
Hi all, I configured my localhost to work with Xdebug and then installed the plugins to work with note++. Everything worked fine and I got the sample two line program to work from the terminal as well as from a browser (chrome) by appending "?XDEBUG_SESSION_START=xyz" after the URL. It worked fine for small programs but for my multi-page application, the appended bit simply disappeared. I guess that's because of jumping to pages on menu clicks where the url is created depending upon the menu button being clicked. Code like : if(isset($_GET['menu_item'])) { $menu_item = fcheckPpage($_GET['menu_item']); switch ($menu_item) { case "menu1": require_once("/some/thing.php"); break; case "menu2": require_once("some/thingelse.php"); break; ... Then I tried the same on firefox by first installing the plugin for it which does not require any strings to be appended to the URL. That too got working but crashed each time at the very same place when it encountered the code shown above in the code box. These are the error messages that I got and It is clear that the the moment the application / program generated it's own url the link to the debugger is lost. Seems like a woeful limitation, I could try and append the XDEBUG... string to the end of each of the generated urls but that would not be a very pretty solution if that did work. If anyone has any suggestions or solutions or an alternative to this I will grateful. Thanks all.
-
I'm struggling to produce results to the screen from the following code: HTML: <script src="http://code.jquery.com/jquery-2.1.4.js"></script> <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <script src="../scripts/autocomplete.js"></script> <div> <input type='text' class='search_input' name='search' id='search' placeholder='search' autofocus onkeypress='search_func("http://webfarm.io/subs/homefront/list_articles.php" , "search_output")'> <div id='search_output' class='search_output'></div> </div> Javascript: function search_func( href , target){ var search = $("#search").val(); search = $.trim(search); if(search){ $.ajax({ method: "POST", url: href , data: { search: search } }) .done(function( msg ) { target.innerHTML = msg; // as above, data holds the result of the request, so all the data returned from your results.php file are in this param but please see below; console.log(msg); }); } else { target.innerHTML = ''; } } What am I doing wrong? Why won't it produce the desired results? Sorry if I'm looking like a help vamp, but I'm not trying to be.
- 1 reply
-
- jquery
- autocomplete
-
(and 2 more)
Tagged with:
-
Hey there guys, I am trying to create a forgotten password / username file named recover.php on this page a user will be able to validate his email to see if it exists and if so will send the information to that users registered email in the database. simple enough except i have a confusing issue with having multiple header redirects it seems. MY CODE: <?php ob_start(); include('include/init.php'); logged_in_redirect(); include('include/header.php'); ?> <h1><span>Forgot your username / password ? </span></h1> <p>In just a couple easy steps, we can recover your info and get you back on your way in no time ! <span style="color:#FF0000">( * All Fields are required )</span></p> <? $mode_allowed = array('username','password'); if(isset($_GET['mode']) === true && in_array($_GET['mode'], $mode_allowed) === true) { if(isset($_POST['forgot_email']) === true && empty($_POST['forgot_email']) === false ){ if(email_exists($_POST['forgot_email']) === true) { echo 'ok'; // <----- HERE I WANT TO REPLACE WITH A FUNCTION CALLED RECOVER(); && HEADER(); /* recover($_GET['mode'], $_POST['forgot_email']); header('Location: recover.php?success'); <---- REPLACE "ok" with THIS CODE exit(); */ } else { echo '<p>We could not find this email in our database ! Are you sure you got the right email ?</p>'; } } ?> // FORM BEGINS FOR USER TO SUBMIT THEIR EMAIL FOR VALIDATION <div class="recover_user_info"> <div id="change_password" style="float:left;"> <table style="margin-left:10px; margin-top:10px; margin-bottom:10px;"> <form name="forgot_data" action="" method="post"> <tr> <td class="register_td_left"><span class="">Please enter your email here:</span></td> <td class="register_td_right" colspan="2"><input type="email" name="forgot_email" size="60" maxlength="60" value=""></td> </tr> <tr> <td class="register_td_left"></td> <td class="extra_data" colspan="2"></td> </tr> <tr><td class="register_td_left"></td><td class="extra_data2" colspan="2"><input class="register-button" type="submit" name="forgot_userdata_button" value="Recover my info"></td></tr> </tbody></table></form> </div> </div> <? } else { die('Utter confusion ensues'); //<--- MAIN REDIRECT FROM ISSET CONDITIONAL.. REPLACE die('utter confusion ensues'); WITH header('Location: index.php'); exit(); } ISSUE: when i click submit without any of the header() in place i get an output of "ok" , which is exactly what i want. now when i place the extra code as shown above in the // brackets , the conditional fails and i get the die('utter confusion') when i add just the main header redirect to send a user back to index for not having a the correctly defined "$data_mode" , the code still works. its when i add the second header(), for when the form is being submitted and redirecting to recover.php?success that it wont function correctly. mind you, i have not even inserted the function of recover(); i was commenting it out, just to get the redirect to the success. anytime i click submit with both header() functions declared i get sent back to the index.php or die('utter confusion ensues'); any suggestions as to why this is happening ? i really cant figure out why the conditional passes if no header is the output , yet when the header is present to be outputted , the entire conditional fails.
- 4 replies
-
- php
- conditional
-
(and 1 more)
Tagged with:
-
I am new to php and need help creating addition and multiplication tables using the html code we were given. I feel like I am on the right track, but I am getting a few errors and I cant figure them out. One of the errors is that it tells me I am not putting in a valid number for rows even though it is a positive number so it should work. Here is my code and all help is appreciated thanks in advance. <html> <head/> <body> <form method="POST" action="<?= $_SERVER['PHP_SELF'] ?>"> <table border="1"> <tr><td>Number of Rows:</td><td><input type="text" name="rows" /></td></tr> <tr><td>Number of Columns:</td><td><select name="columns"> <option value="1">1</option> <option value="2">2</option> <option value="4">4</option> <option value="8">8</option> <option value="16">16</option> </select> </td></tr> <tr><td>Operation:</td><td><input type="radio" name="operation" value="multiplication" checked="yes">Multiplication</input><br/> <input type="radio" name="operation" value="addition">Addition</input> </td></tr> </tr><td colspan="2" align="center"><input type="submit" name="submit" value="Generate" /></td> </tr> </table> </form> <?php //check to see if num of rows is numberic if (isset($_POST["rows"]) && is_numeric($_POST["rows"])){ //check to see if rows is a positive number if($_POST["rows"] > 0){ if(isset($_POST) && $_POST['operation'] == "multiplication") { for($r = 0; $r < $_POST["rows"]; $r++){ echo '<tr>'; for($c = 0; $c < $_POST["columns"]; $c++){ echo '<td>' .$c*$r. '</td>'; echo '</tr>'; }} } else if (isset($_POST) && $_POST['operation'] == "addition") { for($r = 0; $r < $_POST["rows"]; $r++){ echo '<tr>'; for($c = 0; $c < $_POST["columns"]; $c++){ echo '<td>' .$c+$r. '</td>'; echo '</tr>'; } } } } else{ echo 'Invalid rows columns parameters'; exit(); } } else{ echo 'Invalid rows columns parameters'; exit(); } ?> </body> </html>