![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
AyKay47
-
Posts
3,281 -
Joined
-
Last visited
-
Days Won
1
Posts posted by AyKay47
-
-
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?
-
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!"); }
-
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.
-
My understanding is that it’s values will be automatically assigned to the keys as follows:
1
[1] 2
[2] 3
[3] 4
[4] 5
value one would be assigned to index 0
I am wondering what happens in that second part of the multidimensional arrayCode: [select]
‘a’ => array(‘b’ => 1, ‘c’)
How would the value c be accessed?
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];
-
Is this an example of a multidimensional array?
yes
If so how would I access the value of 1 from key b?$array['a']['b'];
Also would the next line ('c') be automatically assigned to the numerical key of c?what?
-
if($slide['active'] == 0 || $slide['payeddeposit'] == 'no') { //do something in TRUE block } else { //do other stuff in FALSE block }
-
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.
-
I did enter the code provided by PFM into the contact.php code. Then, I filled in and submitted the form. Then, I checked my email and received the following:
New Comments Received...
Name:
Zipcode:
Phone:
Email:
Message:
website.com
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.
-
well i have a problem... i have a website running and anyone can get to the admin control panel login page by going to "mywebsite.com/admin" how can i hide this or change it so that they cant get to it unless they know it...?
If it requires a login, what is the issue?
problem 2... when u visit my website... its shows in the url the path of the file for example... "mywebsite.com/register.php" when on the register page or like "mywebsite.com/sells.php" if on the sells page... how can i hide it so that only my website name is showing and not the path of the file?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.
How do I send form input data to a PHP script via AJAX
in Javascript Help
Posted
This line:
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.