954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need help in PHP???

Hi All,

I am making an application in PHP using ajax as i dicussed in my last forums about multiple select boxes . Now the problem is coming that my application is running well . Let me explain whole of this:

Like i have made one application for country , state and city. When we select country from list which i am fetching from database after that selecting country list of states will present and after selecting state list of cities will present. This all is running well. But now when i am submitting all selected values in database now the problem is that i am getting not complete value of city or state.

Like i am passing value of city or state is " Los Angales" or " NEW YORK" but in database this after submitting this it is showing first word like this " Los " in place of "Los Angeles " and it should show " NEW YORK " but it is showing only " NEW " .

But i want to show whole value in my database after submitting these value . Is there any function in PHP with which i can show whole values ?

Please Help me.

Thanks,
Gagan

gagan22
Junior Poster
131 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

If you print_r() on $_POST or $_GET, depending on the form method that you are using, are the full values being passed to the page?

Baldy76
Newbie Poster
21 posts since Jun 2009
Reputation Points: -1
Solved Threads: 3
 

Hey, you are right, i don't know which way you are putting in page with all the menu.
All the state and city menu is not consider each other. so might be a problem in menu set up.

-----------------------------------

Joyce Sullivan
Newbie Poster
13 posts since Jan 2009
Reputation Points: 10
Solved Threads: 2
 
If you print_r() on $_POST or $_GET, depending on the form method that you are using, are the full values being passed to the page?


Thanks for reply,,

form method post i am using. and i am passing value like this.

echo " <select name=state>";
echo "<option value='$row[statename]'>$row[statename]</option>";
echo " </select>";


Like state name have name "NEW YORK" . As it is showing in form when i am selecting this value and submitting form with value $_POST[state] . But in databse this is showing just " NEW " but this should insert " NEW YORK" . This point is confusing me.

please help me . how i can solve this.
thanks

gagan22
Junior Poster
131 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

try

echo "<option value='" . urlencode($row['statename']) . "'>" . $row['statename'] . "</option>";
Baldy76
Newbie Poster
21 posts since Jun 2009
Reputation Points: -1
Solved Threads: 3
 

try

echo "<option value='" . urlencode($row['statename']) . "'>" . $row['statename'] . "</option>";


thanks for reply,

when i am using this code as you suggest me . I am able to show whole value now . But this is showing + sign in both of these word.

Like NEW+YORK in database . But i want to show this should show like this NEW YORK means there should come space between these both words.

How i can insert space in between both of these word. Please help me to solve this issue also.
Thanks for so much help.

gagan22
Junior Poster
131 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

in your query, use

$query = "insert into blah blah blah values('" . urldecode($_POST['selectname']) . "')";
Baldy76
Newbie Poster
21 posts since Jun 2009
Reputation Points: -1
Solved Threads: 3
 

This is the most basic, you should also look into mysql_real_escape_string() when inserting any outside submission into a db, but this has nothing to do with the issue in question though.

Baldy76
Newbie Poster
21 posts since Jun 2009
Reputation Points: -1
Solved Threads: 3
 

in your query, use

$query = "insert into blah blah blah values('" . urldecode($_POST['selectname']) . "')";


Thanks for giving so much time .

I have solved this. Now value is going very well as i need it.

Thanks sir.............

gagan22
Junior Poster
131 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

Thanks for giving so much time .

I have solved this. Now value is going very well as i need it.

Thanks sir.............


Glad I could help.

Baldy76
Newbie Poster
21 posts since Jun 2009
Reputation Points: -1
Solved Threads: 3
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You