Solved

find string

Posted on 2009-05-06
1
135 Views
Last Modified: 2012-05-06
hello there,
how can I make something so that if strings like these

'successfully submitted'
'Thank you for submitting'
'submitted successfully'

are found in a data to echo success..
0
Comment
Question by:XK8ER
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 19

Accepted Solution

by:
Michael701 earned 500 total points
ID: 24317773
guess you could just use strpos to see if the string is in the data

there is probably a better preg_grep but I'm not an expert with them

if (strpos($data, 'successfully submitted')!==false or strpos($data, 'Thank you for submitting')!==false or strpos($data, 'submitted successfully')!==false)
{
  echo "success";
}

// !== false is a special check to make 'not found' different the 'found start of data' which returns a zero
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question