AyKay47
Members-
Posts
3,281 -
Joined
-
Last visited
-
Days Won
1
Everything posted by AyKay47
-
How do I send form input data to a PHP script via AJAX
AyKay47 replied to drayarms's topic in Javascript Help
This line: $.post("check_email_input.php",{data:data_string}, means that you are sending a $_POST value to the server with the key 'data'. You are trying to use the key 'email' to grab this data, obviously this will not work. You need to use $_POST['data'] instead. -
Please post the relevant code.
-
That would actually add an extra step and require much more code. Loops are your friend.
-
Based off of the JS you have, the text field needs to have an id of 'message_wall'.
-
When debugging javascript, I tend to use alerts each step to make sure that every level works correctly before moving on. There are also browser Developer tools available to debug front-end code: such as FF's firebug and Chrome's Dev Tools.
-
My mind reading skills are off today, Make another thread for this, showing the relevant code and the issue.
-
Ah, you are not escaping the double quotes that you use for the style attribute.. Change to: $("ul#wall").prepend("<li style=\"display: none;\">"+message_wall+"</li>"); $("ul#wall li:first").fadeIn(); or wrap it in single quotes: $("ul#wall").prepend('<li style="display: none;">'+message_wall+'</li>'); $("ul#wall li:first").fadeIn();
-
You are using strtolower() for the switch comparison. So you need to compare 'a3' and 'a4' not 'A3' and 'A4'
-
This: <script type="text/javascript"> $(document).ready(function(){ $("form#submit_wall").submit(function() { var message_wall = $('#message_wall').val(); $.ajax({ type: "POST", url: "insert.php", data: "message_wall="+ message_wall, success: function(){ alert("success!"); } }); return false; }); }); </script> should most certainly work. If it doesn't, make sure that the path leading to insert.php is correct. Edit: Now it works?
-
Change Div background colour dependent on PHP variable
AyKay47 replied to jaek's topic in PHP Coding Help
This will be tricky to do solely with PHP unless you build the HTML dynamically inside the PHP from the data gathered. PHP can't modify html elements. You could use JS for this, though. -
What do you mean by "it's not working"? What exactly is happening. As far as I can tell, the switch is fine, although I can tell you right now that the query won't work when it's built, because you are mixing PHP functions into the query without concatenation.
-
alright, let's start with the absolute basic and move up from there. $("form#submit_wall").submit(function() { alert("form submitted"); return false; });
-
1. You have ended the <head> tag before the javascript code. 2. Does anything happen at all when you submit the form? 3. use .val() instead of .attr('value') when grabbing field values. 4. Have you debugged this at all to make sure that the request is even being sent? $.ajax({ type: "POST", url: "insert.php", data: "message_wall="+ message_wall, success: function(){ alert("success!"); }
-
Change Div background colour dependent on PHP variable
AyKay47 replied to jaek's topic in PHP Coding Help
1. Don't use the global keyword, ever. Especially when you are already in the global scope. 2. Id's are meant to specify one element by nature, you have specified a <div> and a <ul> with the same id. This defeats the purpose of using an id. Either set unique id's for each element or use a class. -
value one would be assigned to index 0 Read Kickens reply further, he answers this question. Value 'c' would be assigned to the first available numeric key, which in this instance is 0. To access 'c' you would use: $array['a'][0];
-
yes $array['a']['b']; what?
-
if($slide['active'] == 0 || $slide['payeddeposit'] == 'no') { //do something in TRUE block } else { //do other stuff in FALSE block }
-
Divide multidimensional array into many arrays
AyKay47 replied to dmhall0's topic in PHP Coding Help
The only thing you are missing is the correct syntax for pushing values onto an array using the [] operator. $name[] = $data['name']; Also, it's a good idea to instead have die(mysqli_error()); to be able to properly debug the query upon failure. Edit: muddy beat me to it. -
Place this code at the top of the page. echo "<pre>"; print_r($_POST); echo "</pre>"; This will display the $_POST values being submitted to the page via form. My guess is that one or more of the post values you are trying to access as arrays are in fact strings.
-
PFM's code has nothing to do with the email. It will output data on contact.php when the form is submitted. What does contact.php look like in your browser when you submit the form.
-
The form sends the data to contact.php You need to add the code that PFM provided to the top of contact.php Provide us with the results.
-
What the code that PFM gave you is going to do is display the values being sent to the form processing page from the form. Post the updated relevant code.
-
[help] hiding website.com/admin control panel php?
AyKay47 replied to bryanmc1988's topic in PHP Coding Help
If it requires a login, what is the issue? This isn't really a good idea as this would not be SEO friendly for crawling etc. Typically people hide the extension of the page to: 1. Add an extra layer of security 2. To create "Pretty URLS". To do the above, look into .htaccess and mod_rewrite -
Then the `agentId` value that you are trying to insert into the `job` table is not found in the `agents` table. This is the nature of foreign keys, they maintain the referential integrity of the database.
-
make sure the form action action="http://p11.hostingprod.com/@Website.com/php/contact.php" is correct, since you are getting blank values where the variable values should be, I suspect that the form is failing to send the data to the correct file.