TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-12-2009, 06:19 AM   #1 (permalink)
The Wanderer
 
sandhyagupta's Avatar
 
Join Date: Jun 2009
Posts: 20
Thanks: 4
sandhyagupta is on a distinguished road
Default How do i get to the last line

Hi tony, wild honey
i tried to code for the populating thing which i asked u before.
here s my code:
HTML Code:
<html>
  <head>
    <script type="text/javascript">
      function ValidateForm()
      {
        var data = document.frmSample.textarea1.value
        // Code for email validation
        var mysplitresult = data.split("\n");
        document.frmSample.contactname.value = mysplitresult[0]
        m = data.match(/\w+[.]?\w+[.]?\w*@\w+[.]\w+[.]?\w+/g);
        document.frmSample.email.value = m
        // code for website
        //n = data.match(/^((http|www):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+\.[^#?\s]+)(#[\w\-]+)?$/);
        //document.frmSample.web.value = n
        // Code for spliting the phone nos
        var n = mysplitresult[1]
        var mysplitresult1 = n.split("-");
        var length1 = mysplitresult1[2].length
        //document.write(length1);
        if(length1==10)
        {
          document.frmSample.mobile.value = mysplitresult1[2]
        }
        else
        {
          document.frmSample.phone.value = mysplitresult1[2]
        }

      }
    </script>
  </head>
  <body>
    <form action=" " method="POST" name="frmSample" onsubmit="return ValidateForm()">
      <table>
        <TR>
          <TD rowspan=10>
               TextArea<textarea name = 'textarea1' rows='28' cols='80'>
               </textarea>
           </TD>
           <TD>
               <input type=button value="click" onclick="ValidateForm()">
           </TD>
        </TR>
        <TR>
           <TD>
               Contact:<input type=text name="contactname" size=25>
           </TD>
        </TR>
        <TR>
           <TD>
               Email id:<input type=text name="email" size=25>
           </TD>
        </TR>
        <TR>
           <TD>
               Mobile no:<input type=text name="mobile" size=20>
           </TD>
        </TR>
        <TR>
           <TD>
               phone no:<input type=text name="phone" size=20>
           </TD>
        </TR>
      </table>
    </form>
  </body>
</html>
i dono wtz wrng in the match function for website.. itz nt displaying it.
n hoe do i get to the last line in the text n display the address.

few egs of wt i will be pasting in the text field are:
Code:
        Mr Rama Moorthy     
        +(91)-(80)-66491588
        info@novatechnosys.co.in 
        ramamoorthym@novatechnosys.co.in 
        No.729,1st Flr, Hal 2nd Stg, 8th Crs,11th Mn, Indiranagar, Bangalore - 560038



      
        Mr Srinivas(Managing Director)    
        +(91)-(80)-66492233
        srinivas@vyasam.com 
        chetan@vyasam.com 
        No. 1 & 2, 3rd Flr, Nr Sharavathi Hospital, Service Rd, Vijaynagar, Bangalore - 560040


          Mr Ananda Reddy K     
        +(91)-(80)-66366685
        ananda@srivatech.com
        www.srivatech.com
        No.430,, 5th Main, Shastri Nagar, Bangalore - 560028

Last edited by Salathe : 06-12-2009 at 01:20 PM. Reason: Wrapping HTML/Examples in code blocks.
sandhyagupta is offline  
Reply With Quote
Old 06-12-2009, 08:22 AM   #2 (permalink)
The Acquainted
 
Hightower's Avatar
 
Join Date: May 2009
Location: Durham, UK
Posts: 134
Thanks: 9
Hightower is on a distinguished road
Default

OMG! FFS! Hoe bout u tri usin sum code tagz n stop typin lyk dis on a forum!
__________________
Hightower's Softpolio
Send a message via MSN to Hightower
Hightower is offline  
Reply With Quote
Old 06-12-2009, 09:26 AM   #3 (permalink)
The Wanderer
 
sandhyagupta's Avatar
 
Join Date: Jun 2009
Posts: 20
Thanks: 4
sandhyagupta is on a distinguished road
Default

stop typing like this on a forum means wt? so plz tell me hw m i supposed to type?
sandhyagupta is offline  
Reply With Quote
Old 06-12-2009, 10:05 AM   #4 (permalink)
The Acquainted
 
Hightower's Avatar
 
Join Date: May 2009
Location: Durham, UK
Posts: 134
Thanks: 9
Hightower is on a distinguished road
Default

ERROR!

ID: 10t
__________________
Hightower's Softpolio
Send a message via MSN to Hightower
Hightower is offline  
Reply With Quote
Old 06-12-2009, 10:08 AM   #5 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

I have a feeling he means, wrap the code in the related bbcode tags.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
The Following User Says Thank You to sketchMedia For This Useful Post:
sandhyagupta (06-13-2009)
Old 06-12-2009, 01:15 PM   #6 (permalink)
The Wanderer
 
Schroder's Avatar
 
Join Date: Mar 2008
Posts: 20
Thanks: 0
Schroder is on a distinguished road
Default

If it's always going to be the very last line of your pasted text you can put this line inside your function:

Code:
mysplitresult[mysplitresult.length-1]
Hope that helps.
Schroder is offline  
Reply With Quote
Old 06-13-2009, 05:09 AM   #7 (permalink)
The Wanderer
 
sandhyagupta's Avatar
 
Join Date: Jun 2009
Posts: 20
Thanks: 4
sandhyagupta is on a distinguished road
Default

@ Schroder Thanks a lot. will try using it in the code. it may help me out.
sandhyagupta is offline  
Reply With Quote
Old 06-12-2009, 01:21 PM   #8 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Note: I've edited the first post to wrap code/examples in prettiness.
Salathe is offline  
Reply With Quote
Old 06-13-2009, 05:11 AM   #9 (permalink)
The Wanderer
 
sandhyagupta's Avatar
 
Join Date: Jun 2009
Posts: 20
Thanks: 4
sandhyagupta is on a distinguished road
Default

@ Salathe thanks a lot for your help. i dint know about this. from next time i shall make sure to wrap the code and post. Sorry for the trouble
sandhyagupta is offline  
Reply With Quote
Old 06-12-2009, 02:25 PM   #10 (permalink)
The Acquainted
 
Hightower's Avatar
 
Join Date: May 2009
Location: Durham, UK
Posts: 134
Thanks: 9
Hightower is on a distinguished road
Default

Can you not edit the SMS language as well?!
__________________
Hightower's Softpolio
Send a message via MSN to Hightower
Hightower is offline  
Reply With Quote
Old 06-12-2009, 03:17 PM   #11 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

I apologize for the rudeness of people here. We have a BBcode that you can wrap code in, that tag is [code] and [/code].

Also, this belongs in the general coding section, so I'm moving it there.
__________________

Village Idiot is offline  
Reply With Quote
Old 06-13-2009, 05:19 AM   #12 (permalink)
The Wanderer
 
sandhyagupta's Avatar
 
Join Date: Jun 2009
Posts: 20
Thanks: 4
sandhyagupta is on a distinguished road
Default

@ Village Idiot Yeah as i said thanks a lot to you also. i was not aware of this. sorry for causing all u people trouble. thank u once again.
sandhyagupta is offline  
Reply With Quote
Old 06-13-2009, 02:54 PM   #13 (permalink)
The Acquainted
 
Hightower's Avatar
 
Join Date: May 2009
Location: Durham, UK
Posts: 134
Thanks: 9
Hightower is on a distinguished road
Default

Hi everyone, sorry for being so sharp yesterday - wasn't having the best of days. Still, that's no reason for the comments I made.

Sorry sandhyagupta

All I meant was to wrap your code to make it easier to read.
__________________
Hightower's Softpolio
Send a message via MSN to Hightower
Hightower is offline  
Reply With Quote
Old 06-14-2009, 01:12 AM   #14 (permalink)
The Contributor
 
Join Date: Nov 2008
Location: Sweden
Posts: 36
Thanks: 1
hjalmar is on a distinguished road
Default

Quote:
Originally Posted by Hightower View Post
Hi everyone, sorry for being so sharp yesterday - wasn't having the best of days. Still, that's no reason for the comments I made.

Sorry sandhyagupta

All I meant was to wrap your code to make it easier to read.
Now i'm gonna be the fucker that everyone hates.. but damn don't apologize because someone skipped school. I've read the initial post several times and I still can't understand what the hell he/she is saying. (Not everyone has English as their first language, uhm and the sms lingo is way beyond my head.)

Your reply is justified. And I like! :)

Hjalmar
hjalmar is offline  
Reply With Quote
Old 06-15-2009, 09:52 AM   #15 (permalink)
The Wanderer
 
sandhyagupta's Avatar
 
Join Date: Jun 2009
Posts: 20
Thanks: 4
sandhyagupta is on a distinguished road
Default

Quote:
Originally Posted by Hightower View Post
Hi everyone, sorry for being so sharp yesterday - wasn't having the best of days. Still, that's no reason for the comments I made.

Sorry sandhyagupta

All I meant was to wrap your code to make it easier to read.
Thats ok not a problem.
sandhyagupta is offline  
Reply With Quote
Old 06-13-2009, 02:58 PM   #16 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

That's okay, Hightower I thought you were a bit cruel, too, but nonetheless, the apology is more than appreciated! Happy days.

Has this issue of extracting the last line been resolved, by the way?
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 06-15-2009, 09:55 AM   #17 (permalink)
The Wanderer
 
sandhyagupta's Avatar
 
Join Date: Jun 2009
Posts: 20
Thanks: 4
sandhyagupta is on a distinguished road
Default

Hi wildhoney,

Thaks a lot for the support.Yes my problem has been resolved. My program is working fine :)
sandhyagupta is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Line Chart in PHP Rendair Advanced PHP Programming 3 08-28-2009 08:17 AM
parsing a page line by line sarmenhb Absolute Beginners 3 12-04-2008 01:58 AM
Adding content to a specific line in file Normo Absolute Beginners 5 10-09-2008 11:20 PM
Need help on nested loop! pabin Absolute Beginners 4 05-12-2008 10:27 AM
uncaught exception: [Exception... "Component returned failure code: 0xc1f30001 (NS_ER Orc Javascript, AJAX, E4X 2 02-26-2008 02:12 PM


All times are GMT. The time now is 06:06 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design