Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Outputting external php into Silverstripe


Go to End


2062 Views

Avatar
Victor

Community Member, 128 Posts

16 March 2009 at 2:23pm

Edited: 16/03/2009 2:25pm

I have a php script which goes to database created by SilverStripe, f.e.:

dosearch.php:

<?php
// database info

$query ="SELECT * FROM StaffPage WHERE `lastname` LIKE '$_POST[last_name]%'"; 

$result = mysql_query($query) or die("Could not execute query");
if (mysql_num_rows($result)==0 ) {print("Not found "); return;
}


while($row = mysql_fetch_array($result)) {
echo $row[lastname].", ".$row[lfirstname];
}
?>


Now I want to put on some page form which is 

<form action='./dosearch.php'>
<input type='text' name='last_name'>
<input type='submit'>
</form>

I surely can do it via iframes but it has its drawbacks. What is the recommended approach? How to accommodate/modify such script

Thank you in advance. Victor