
Skewled
Members-
Posts
387 -
Joined
-
Last visited
Everything posted by Skewled
-
echo "durations = " .$d. " " .$a. " " .$b. " " .$c; should be: echo "durations = " .$d. " . " .$a. " . " .$b. " . " .$c. "; It's really late and I apologize if I'm wrong lol!
-
1. Query the Database to determine the values needed 2. Add a conditional statement to show which page you need to load for the user and load it I don't know if your using a Framework or if you're using modular code to create these pages so I can't really bring much to the table other than what I mentioned, I would be using templates with a MVC approach and I'd just load the content dynamically with jQuery depending on what my GET returned.
-
Ok in action php you'd need to add a return value for either success or failure and json_encode it. So here is an example: <?php public function login() { // Handle Your POST input and assign your variables // Do your query $result = "SELECT * FROM ...."; if($result) { // You would compile your json_encoded statement here for success json_encode(['result'] => 1]); // This will not work it's just to guide you return_false; // exit the function } else { // You would compile the same as above without returning false json_encode(['result'] => 0]); // This will not work it's just to guide you } Now you'd edit your form as follows to add a new div to populate the html output: <div id="login"> <h1>Login</h1> <div id="error"><!--Dynamic jQuery Return --></div> <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" target="_self" title="Registratie"> <label>Email adres: </label><input name="email" type="email" id="email"> <br> <label>Wachtwoord: </label><input name="wachtwoord" type="password" id="wachtwoord"> <br> <p><a href="#">wachtwoord vergeten ?</a></p> <br> <input name="login_submit" type="submit" id="login_submit" value="Login"> </form> </div> Now all you'd need to do is finish off the JavaScript I posted above in my previous post. <script type="text/javascript"> $(function() { $("#login_form").submit(function(o) { o.preventDefault(); var url = $(this).attr('action'); var postData = $(this).serialize(); $("error").hide(); $.post(url, postData, function(e) { if (o.result == 1) { // We get the result from PHP/SERVER SIDE window.location.href = ''; // Where to go on success } else { // What to do if the login was not found // Populate the div for login error $("error").append('Username / Password Invalid.'); } }, 'json'); }); }); </script> Most of this is pseudo code to help you get on track and most of it is accurate except for how you deal with your database. I hope this helps you and puts you in the right direction.
-
$form[] = array('dept'=>$dept, 'company'=>$company, 'address'=>$address, 'service'=>$service, 'box'=>$box, 'destroydate'=>$destroydate, 'authorised'=>$authorised, 'submit'=>$submit); should also not have the [ ]
-
pull data from select box and fill in a input field
Skewled replied to rdkurth's topic in Javascript Help
Where is $("#id").on("change", function() { located? I don't see any id="id"; anywhere and I suppose this is what is causing your issue, it can't recognize the change because one never occurred. -
Looking for AJAX/jQuery solution with PHP/CI
Skewled replied to nydeveloper's topic in Javascript Help
Greetings nydeveloper, I think I understand what you're asking for, you would like the data on your page to update at set intervals to reflect the updates performed by your cron jobs? You could use jQuery to do a refresh on the div every x seconds to achieve the result your looking for. This will show you about setInterval() which is what I'm talking about, and I would use this in my success area after polling the server for the new data. http://www.w3schools.com/jsref/met_win_setinterval.asp I hope this helps you out (: -Gaddam -
You can do it by posting the data, I don't see an attempt on your part to post the actual data, Are you wanting it written for you? Here is an example of posting data from a form called "login_form" which has 2 input fields of "username" and "password", the var postData = $(this).serialize() builds the array which I would use PHP to grab the $_POST['field'] from. Typically: <script type="text/javascript"> $(function() { $("#login_form").submit(function(o) { o.preventDefault(); var url = $(this).attr('action'); var postData = $(this).serialize(); $.post(url, postData, function(e) { if (o.result == 1) { // We get the result from PHP/SERVER SIDE window.location.href = ''; // Where to go on success } else { // What to do if the login was not found } }, 'json'); }); }); </script>
-
Without knowing your structure internally we would be throwing code out that may never work.
- 1 reply
-
- mod rewrite
- mod
-
(and 2 more)
Tagged with:
-
Accessing object map holding updated data.
Skewled replied to RuleBritannia's topic in PHP Coding Help
You could do this by serializing an object and unserializing it later to update it or to allow it to be saved long term in a database. Once you are ok with updating the database you could either store the object or just the changes you want. -
Linux or Windows, what mail program you using?
-
Provide some code otherwise this is too vague to even answer.
-
Add or die() to the 2nd query and see what MySQL states.
- 3 replies
-
- while loop
- php
-
(and 3 more)
Tagged with:
-
You could send the information along in a URL encoded string if you wanted, or you could just send it over GET. If you put something together and post up some code I'm sure someone here will help you, but you gotta give something to get something.
-
script not working when included in different file-
Skewled replied to ryanmetzler3's topic in PHP Coding Help
What does index.php contain and were the changes made correctly within that file to reflect the new database? -
This will return a print out of that. It's up to you to tweak and add the data you want. <?php echo 'ASEAN Reports<br>'; echo '<table>'; echo '<tr>'; echo '<th>Tue</th>'; echo '<th>Wed</th>'; echo '<th>Thur</th>'; echo '<th>Fri</th>'; echo '<th>Sat</th>'; echo '<th>Sun</th>'; echo '<th>Mon</th>'; echo '</tr>'; echo '<tr>'; echo '<td>1</td>'; echo '<td>2</td>'; echo '<td>3</td>'; echo '<td>4</td>'; echo '<td>5</td>'; echo '<td>6</td>'; echo '<td>7</td>'; echo '</tr>'; echo '</table>'; echo '<br>'; echo 'Country<br>'; echo 'Reports<br>'; echo 'Report1<br>'; echo 'Report2<br>'; ?>
-
$rss = $doc->createElement("rss"); $version = $doc->createAttribute("version"); $version->value = "2.0"; $nameSpace = $doc->createAttribute("xml:ns"); $nameSpace->value = "http://www.w3.org/2005/Atom"; Above the values are assigned, then added to the XML file below: $doc->appendChild($rss);
-
You could enumerate the field to have multiple picks for a given event.... *Runs to bed* I'm too tired to be here, and let a lone try to be helpful! lol!
-
http://php.net/manual/en/language.references.pass.php Been awhile since I looked at new additions to PHP but yeah that's pretty sweet!
-
That's rather interesting, glad it's working though!!
-
<?php // Connect to the database and establish values for Aurtua bonus. $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // $increment=10; $fields = Array("points"); // foreach ($fields as $fld) { $query = "update table set $fld=($fld+$increment) where winner = 'fighter1'"; mysqli_query($dbc, $query) or die("cannot execute: ". mysql_error()); echo "completed"; } mysqli_close($dbc); ?> You'd have to enter your connection information, adjust the table name and the winner to match the correct name, but that's workable. You could also alter it to take input from a field from a form that you'd have access to, and just type the winner name and run the script to step over all the fields and reward the winners.
-
yeah you could throw them in a foreach and update all the records that resulted in the correct choice
-
if (isset($_SESSION['user_id']) && isset($_SESSION['username']) && isset($_SESSION['password']) &&!empty($_SESSION['user_id']) && !empty($_SESSION['username']) && !empty($_SESSION['password'])) { // Execute code here } else { // do redirect } The page that the login for redirects to should check for the session data or redirect back to the login page, I want to see if the session data is being deleted properly. The above code will check that the session is set and that the values are not empty then proceed. Pretty late here and my brain is mush, hope you get it solved soon, make sure to echo all variables to verify they are correct as stated above and then move piece by piece over the code to help debug any issues with mistyping etc.. I don't know what the redirect page has for code so I'm hoping your checking the data like above
-
/*Unset and destroy users session data*/ if(isset($_SESSION['username'])){ $_SESSION = array(); session_destroy(); header("location: ./"); } else{ header("location: ./"); } Rather then unset for all those $_SESSION values give the above a shot.