PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi,
I need help in my PHP code, this simply takes all values from all text boxes on my form and sends all to my email.
The problem is that it reverses the fields, for example, 1st field is name, 2nd is email and 3rd is message on my form, but this form sends it to me in reversed order!
This is the first lines of my code which collects all fields and I think should be changed:
Code:
Well, array_pop() pops the last element off of the array and then you add that to $temp, essentially reversing them. Lot's of ways to do this, but to keep inline with your code, try this:
Although, the easiest fix would be to change array_pop() to array_shift() But the original code looks wacky and you shouldn't use $HTTP_POST_VARS as it is deprecated and may not be enabled on current systems anyway.
Last edited by AbraCadaver on Tue Mar 30, 2010 2:50 pm, edited 1 time in total.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Just one more question
It will send all fields now, including a Captcha and Submit ?!
How can I remove these 2 fields?
This is a sample email I receive now:
Sender's IP Address : = 38.98.x.x - United States
FullName : = gdsf
Serial : =
Email : = fsd@dsfa.das
Topic : = Sales Query
Description : = Message
Captcha : = LFNF
Submit : = Submit
Yes. But really you should be collecting known values and not collecting all values except certain ones. As an example, instead of the loop, I would use:
You should also be checking for spam/malicious content. Earlier I was just attempting to explain your initial problem and show you a possible alternative.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.