hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : AJax & PHP problem
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

AJax & PHP problem

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 06-23-2006, 05:01 AM
mr5 mr5 is offline
Junior Guru Wannabe
 
Join Date: Jan 2004
Posts: 72

AJax & PHP problem


Hello,

I am trying to write a check multi domain script by Ajax & PHP. User will input multi domains in seperate line by enter after each domain.

However, my PHP script backend can not split domains user inputed. You can test my AJAX at: http://www.liemonline.com/ajax

My getdata.php code:

<?
print_r(explode("\r\n", $_GET['domain']));
?>

Hope someone can help me. Thank you.

Regards,

Reply With Quote


Sponsored Links
  #2  
Old 06-23-2006, 05:21 AM
probonic probonic is offline
Web Hosting Master
 
Join Date: Jul 2002
Location: Manchester, UK
Posts: 774
Try splitting on just "\n" instead of "\r\n".

Reply With Quote
  #3  
Old 06-23-2006, 08:57 AM
orbitz orbitz is offline
Web Hosting Master
 
Join Date: Mar 2004
Posts: 1,301
not a good idea to have a textbox and ask users to enter domains in separate line. What if a user enters them all in a single line? would your script deal with this situation or it just throws error?

Reply With Quote
Sponsored Links
  #4  
Old 06-23-2006, 12:55 PM
Burhan Burhan is offline
Community Guide
 
Join Date: Jul 2003
Location: Kuwait
Posts: 5,100
You are not URL encoding the data that is being sent to your script.

When your user enters two domains, your script is sending them as

domain?=foo.combar.com

because your script is not translating the \r\n into their url entities; even if it did, on the other end you would have to urldecode the query string and then run the explode on it.

Its just easier to delimit the user input with a character. So in your script with the form, replace the \r\n with | or ; or something else.

__________________
In order to understand recursion, one must first understand recursion.
If you feel like it, you can read my blog
Signal > Noise

Reply With Quote
  #5  
Old 06-24-2006, 04:25 AM
mr5 mr5 is offline
Junior Guru Wannabe
 
Join Date: Jan 2004
Posts: 72
Hello,

Thank you very much. I decided to split the data by: split() function (I found that Javascript works well with \r\n) before send to PHP

Regards,

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Outbound Spam Causing Sleepless Nights? Blog 2013-05-13 09:52:21
How To Deliver Products Customers Will Pay For with David Koston - HostingCon 2012 Web Hosting News 2012-07-18 10:46:16
Q&A: Ruslan Fazlyev of Ecwid Talks Shopping Cart Software Web Hosting News 2012-05-14 16:06:17
Web Host Webhostforasp.net Launches New Affiliate Program Web Hosting News 2012-01-16 14:31:12
The Lesson of the Ten, with Jeff Hardy Web Hosting News 2011-08-08 22:12:01


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?