Jump to content

rocky_88

Members
  • Posts

    39
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

rocky_88's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I ran into this confusion while trying to write a script for uploading a file using AJAX which would work in IE8. Apparently there is a hack to achieve this which involves the usage of iframes. What I've tried so far is submitting a form with just action attribute which redirects to another page. <form method="post" action="test.php"> <input type="text" name="name" /> <input type="submit" name="send" value="Send" /> </form> Even if I set the attribute to _self(default value), the page redirects to test.php and shows what ever is printed by the php script. Now when I set the target to _blank, the page test.php opens in a new tab and shows what ever is printed by the php script. <form method="post" action="test.php" target="_blank"> <input type="text" name="name" /> <input type="submit" name="send" value="Send" /> </form> And if I set the target to an iframe name present in the same page, the php response is printed in the iframe(which is the hack to upload a file) <form method="post" action="test.php" target="some_frame"> <input type="text" name="name" /> <input type="submit" name="send" value="Send" /> </form> <iframe name="some_frame" /> So what I want to know is how does the action and target attribute work once the form is submitted? When the target attribute is set to _self, the page redirects and then prints(action first and then target), but if the target attribute is set to _blank, first a new tab is opened and then the response is printed(first the target and then action) and when the target attribute is set to a frame_name, it prints within the frame(does it load the response from the page into the frame?). It would be really helpful if someone could assist me with a link or an explanation of the flow of a form submission, the order of execution of the action and target attributes and how do they work and in what order do they run.
  2. Charset of database is also UTF-8
  3. Ya, this problem never occurs when I use php. It happens only when I try to get data using ajax.
  4. @scootstah Thank you for the quick response, Yes, I do have that in HTML head, but still it does not seem to work unless I use utf8_encode function.
  5. I'm using ajax to retrieve data from database. Using php when I echo the data, spanish characters such as "á é" are replaced by "�". After searching for hours I found out that this happens due to different charset. Using php utf8_encode() solves the problem and all characters are displayed properly. Out of curiosity I used mb_detect_encoding() to check the encoding and it shows that the encoding is UTF8. So if the encoding is UTF8 by default, then why dont I get proper output without the use of utf8_encode function?
  6. I'm pretty sure that it does work that way as i'm validating other fields too using regex and they work just fine. Its just with this particular "alphabets only" condition.
  7. This is the output. For my code, it shows invalid if I use regex and valid if I use ctype_alpha().
  8. @Pikachu2000 I tried random values. It shows invalid for abcd xyz or anything that I enter.
  9. @Pikachu2000 Thanks for that, it did the job. Any idea as to what's the error in the code I mentioned?
  10. I'm unable to validate my text box which should contain only alphabets. Here is the code $string=preg_match("/^[a-zA-Z]+$/",$string); if($string) { echo "Valid"; } else { echo "Invalid"; } Even though the textbox contains only alphabets, it shows invalid. I dont know what i'm doing wrong here. However, if I leave a space inside the character class, it validates the string. I've checked the output of the string and there are no spaces what so ever, yet it shows invalid.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.