I have a text box in my webpage where users can enter the data. They will be entering it in a specific format. I wish to parse the content a extract few words from the submission If the user type "I am xyz. I am from abc." I want to get the words xyz and abc using reg expression in php. Further I want to redirect the user to another php page named abc.php and greet the user " Hello xyz" and so on (i, if the user enter "I am pqr. I am from sv"he should be redirected to sv.php and greet him "Hello pqr") I will be using post function in html to post the data. I will be very greatful if some one could help me by writing the code of the php code of the page to which I need to POST the data entered. Please help.
I have read about this in some tutorial. but don't know how to use it in a php file . if you don't mind cud write the code for the page. And how do I do the redirection stuff? Anyway thanks a lot for the response.
I am not getting the desired results it is simply displaying "Array" For your ref. here is the php code i used <?php preg_match('/I am (.*?). I am from (.*?)/',$_POST['text'],$match); print_r($match); ?> PHP: and my html form is <form method="POST" action="file.php"> <p><textarea rows="10" name="text" cols="47"></textarea><input type="submit" value="Submit" name="text"></p> HTML: And when I added the headers then also it is not getting redirected. simply shows .ph/name= here is code i used <?php header('Location: '.$match[2].'.php?name='.$match[1]); preg_match('/I am (.*?). I am from (.*?)/',$_POST['text'],$match); print_r($match); ?> PHP: I am beginner in php . Pls help