-
Posts
3,404 -
Joined
-
Last visited
-
Days Won
55
Everything posted by Ch0cu3r
-
Need Help in Hiding Response code fro SMS gateway API
Ch0cu3r replied to navachaitanya's topic in PHP Coding Help
Set the CURLOPT_RETURNTRANSFER option to true $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_HEADER,FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // set to true to have curl return the response, rather than output it directly // $response will now contain the sms confirmation code $response = curl_exec($ch); // close cURL resource, and free up system resources curl_close($ch); -
What is line 55 of user.php? This will be why your javascript code cannot parse the json from the response because both the php error message and json encoded array are being returned.
-
You need to use echo before highlight_string if you want to output the source code with syntax highlighting echo highlight_string($SourceFile);
-
Could you post the errors you are getting. Also could you tell us what is $user->data() is returning? (use print_r or var_dump to see contents).
-
Because your links are wrong <a href="ShowSourceCode.php"? source_file=SimiliarNames">[View the Source Code]</a> ... <a href="ShowSourceCode.php"?source_file=EmbeddedWords">[View the Source Code]</a> Your links will not be passing the querystring to ShowSourceCode.php, it needs to be within the href attribute. <a href="ShowSourceCode.php?source_file=SimiliarNames.php">[View the Source Code]</a> ... <a href="ShowSourceCode.php?source_file=EmbeddedWords.php">[View the Source Code]</a>
-
There is not set support length. MySQL improved may look similar to mysql_functions but it is not. Do not come under the illusion all you need to do is add an 'i' after mysql in the function names. There are differences, for example some mysql_() functions took the connection resource as an optional argument. However the mysqli equivalent functions now require it and is usually the first argument. You should study the mysqli documentation for the differences. Then maybe stick with procedural programming if you are not used to OOP.
-
benanamen is referring to the use of mysql_() functions. These functions have been deprecated (no longer supported) for a while and is to be removed completely in the upcoming release of PHP7. You have two options you can either use PDO or MySQLi to connect to your mysql database. Now the other problem with your code is not very good. You are not using OOP correctly. Globals has absolutely no use in OOP (or in procedural code to be honest). If a method requires external value(s) in order to perform the task you should be passing those value(s) as arguments, not defining them as global If a object needs to use a value within another method of the same object then you should be saving it as a property. You will use $this to access the objects properties in the other methods of the object.
-
How to pass pop up prompt value to its assigned textbox.
Ch0cu3r replied to samuel_lopez's topic in Javascript Help
As you have named your file field as filename[<?php echo $row['student_id'] ?>] You need to add the student id to the $_FILES array $file = $_FILES['filename']['name'][$ids]; $file_loc = $_FILES['filename']['tmp_name'][$ids]; $file_size = $_FILES['filename']['size'][$ids]; $file_type = $_FILES['filename']['type'][$ids]; Next make sure the studentdocument/ directory exists and is in the same directory as your php file that is processing the upload. You may also need to set the necessary file permissions to allow PHP to write that directory too. -
How to pass pop up prompt value to its assigned textbox.
Ch0cu3r replied to samuel_lopez's topic in Javascript Help
You can not customize the javascript prompt. However you can create your own custom popup windows the modern way is to create a modal window I assume you mean the file upload. If so then please read the following chapter Handling file uploads in the php manual it explains how PHP handles file uploads. When saving the uploaded file to the database you should only be storing the filename (or path to the file). The file itself should stored on the servers file system. Why is there two different fields named filename? -
What is the best method to write long if - else conditions?
Ch0cu3r replied to thara's topic in PHP Coding Help
Yes you can however you need to write the switch statement differently. Like so // matches which 'case' evaluates to true switch(true) { case($emission <= 100 ): $cssClass = "emission_a"; break; case($emission <= 120 ): $cssClass = "emission_b"; break; case($emission <= 150 ): $cssClass = "emission_c"; break; case($emission <= 165 ): $cssClass = "emission_d"; break; case($emission <= 185 ): $cssClass = "emission_e"; break; default: $cssClass = "emission_g"; break; } } -
How to pass pop up prompt value to its assigned textbox.
Ch0cu3r replied to samuel_lopez's topic in Javascript Help
I don't understand what do you mean by that? -
It is no good just dumping the code. How are supposed to help if do not explain what it is you are trying to do?
-
what is the difference between php web and php command line?
Ch0cu3r replied to lobster's topic in PHP Coding Help
Yes, because its command line only. Command Line/Terminal is plain text only. As I mentioned earlier to have that code display the form you need to run your code from PHP enabled HTTP server. You then browser to your php file in your browser to run the code. -
What? Where you getting fd from This is what I said
-
Your <table id="projectOptions"> ... </table> needs to be wrapped within <td></td> tags.
-
Look at the four lines of code. What line do you think is displaying the number?
-
$myname needs to be $myName
-
Yes with the highlighted corrections in red That'll be pretty much the same code I posted earlier and what Psycho had also posted
-
To print a random number from $myName you can do $myName = "Alison"; $randomPosition = rand(0, 5); echo "Random letter from $myName: " . substr($myName, $randomPosition, 1); // or as simply as echo "Random letter from $myName: " . $myname[$randomPosition];
-
How to pass pop up prompt value to its assigned textbox.
Ch0cu3r replied to samuel_lopez's topic in Javascript Help
Oh the grade id in your screenshot is the $row['student_id'] value. In that case change stud_ids = name.match(/\d+/)[0]; to be stud_ids = name.match(/\[(.*)\]/)[1]; -
How to pass pop up prompt value to its assigned textbox.
Ch0cu3r replied to samuel_lopez's topic in Javascript Help
Remove the onclick="prompt" from your radio buttons you don't need that now. The javascript should either be placed between the <head></head> tags or before the closing </body> tag -
How to pass pop up prompt value to its assigned textbox.
Ch0cu3r replied to samuel_lopez's topic in Javascript Help
Make sure you are loading Jquery into your page before that code Edit On the last line before </script> remove the characters in red })(); Change $('input[type=radio]').on('click', function(e) { ... code ... }); to be $('input[type=radio]').on('click', function(e) { // if this radio button value is not Passed if($(this).val() != "Passed") { ... code ... } }); -
How to pass pop up prompt value to its assigned textbox.
Ch0cu3r replied to samuel_lopez's topic in Javascript Help
You need to name your remarks and filename fields with the same student id as your radio buttons <td><input type="text" name="remarks[<?php echo $row['student_id'] ?>]" /></td> <td><input type="text" name="filename[<?php echo $row['student_id'] ?>]" /></td> Now when the user clicks the radio button you can need to only populate the remarks and filename textfields that use the same student id in thename. To handle this I would use Jquery <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script type="text/javascript"> $(function() { $('input[type=radio]').on('click', function(e) { // get the radio button name attribute value for the radio button that was clicked on name = $(this).attr('name'); // extract the student id from from the radio button name student_id = name.match(/\d+/)[0]; // target the remarks and filename textfields that are associated with the same student id remarksField = $('input[name="remarks['+student_id+']"]'); filenameField = $('input[name="filename['+student_id+']"]'); // display remark prompt and populate the prompt with the existing value enteredRemark = prompt('Enter your remark', remarksField.val()); // display filename prompt and populate the prompt with the existing value enteredFilename = prompt('Enter your filename', filenameField.val()); // apply the values for the remarks and filename textfields remarksField.val(enteredRemark); filenameField.val(enteredFilename); }); })(); </script> See Live Demo -
Well if you are going to display the current pad_count before the update then yes you'll still need to the select query.