473,473 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Extract Select box with data from HTML

Hi,

Consider the following html EMBEDDED in a php variable say contents

<html><body><form name="xyz" method="post" action="xyz.php"><select
name=ListID><option value="T80240">BOOKSLIST</option><option
value="T80238">LIST TEST</option><option value="T80239">NEW
TEST</option><option value="T80236">T80233</option><option
value="T80237">T80233</option><option value="T80235">TEST
LIST</option><option
value="T80233">mylist</option></select></form></body></html>

How would I use preg_match to retrive all data from <select
name=ListID> to </select> in one variable ignoring rest of the html?

Thanks

Mar 22 '06 #1
1 1929
ni*******@gmail.com wrote:
Hi,

Consider the following html EMBEDDED in a php variable say contents

<html><body><form name="xyz" method="post" action="xyz.php"><select
name=ListID><option value="T80240">BOOKSLIST</option><option
value="T80238">LIST TEST</option><option value="T80239">NEW
TEST</option><option value="T80236">T80233</option><option
value="T80237">T80233</option><option value="T80235">TEST
LIST</option><option
value="T80233">mylist</option></select></form></body></html>

How would I use preg_match to retrive all data from <select
name=ListID> to </select> in one variable ignoring rest of the html?

Why not parse the HTML and use the DOM interface? Maybe not the fastest
for this example, but easier in the more general case.

--
Ian Collins.
Mar 22 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Don Crossman | last post by:
Assume a MYSQL table, foo. One column, bar datetime. Two rows: 2004-01-01 08:00:00 2004-02-01 08:00:00 select * from foo where extract(day from bar)=1; 2 rows in set...
1
by: Tim Smith | last post by:
I am looking to extract form element values from html, more generally I have a substring that identifies the beginning of a value and a string that identifies the end of value and I need to extract...
9
by: Brian Hanson | last post by:
Hi, I have an unusual problem that just showed its ugly head at a pretty bad time. I have an asp.net (VB) app that takes data from an Excel sheet and puts it into SQL Server. I get the data...
2
by: | last post by:
While I can extract the option value from the following: <Select name='Keystring' MULTIPLE> <option value='1' name='status'>Pending</option> ..... </select> I cannot seem to extract the...
1
by: steveyjg | last post by:
I want to extract the following data from a retrieved html file and store the information as strings. 'get the text of "title" <h1 id="test_title">title</h1> 'get the contents of the value...
1
by: tim999 | last post by:
Hi everyone, I've been working on a large data extract and was wandering if anyone could take a look at the following code and offer any reasons why it takes such a long time compared to when i...
4
by: SandIsland | last post by:
I am trying to extract just a portion of data from an XML data source: <Row> <Col Name="Col0">123456<CellColour>36</CellColour> <FontColour>1</FontColour> <Bottom>1</Bottom>...
1
by: rcamarda | last post by:
I'd need to have a function that allows me to extract 'fields' from within the string I.E. (kinda pseudo code) declare @foo as varchar(100) set @foo = "Robert*Camarda*123 Main Street" select...
1
by: sivadhanekula | last post by:
Hi everyone, I have a problem with my Mysql data. I have 2,95,67,456 lines of data which is too much and if I run this in MYSQL front-end it is telling "OUT OF MEMORY". Any way with my collegues...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.