Page 1 of 1

Javascript to PHP

Posted: Wed Oct 04, 2006 8:16 am
by SPLITER
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I have a some html and javascript knowledge and Im trying to learn php. I have made a search engine in javascript and I am trying to make a php version of it. I am trying to make two versions of it. A google version and just an advanced serach engine.

This is my search script:
[syntax="html"]
<script language='JavaScript'>
<!--



function startSearch(){
searchString = document.searchForm.searchText.value; 
if(searchString != ''){
searchEngine = document.searchForm.whichEngine.selectedIndex + 1;
finalSearchString = '';

if(searchEngine == 1){
finalSearchString = 'http://www.google.com/search?hl=en&lr=&safe=off&q=' + searchString;
}
if(searchEngine == 2){
finalSearchString = 'http://www.google.com/search?hl=en&lr=&safe=off&q=' + searchString;
}
if(searchEngine == 3){
finalSearchString = 'http://www.google.com/search?hl=en&lr=&safe=off&q=+' + searchString;
}
if(searchEngine == 4){
finalSearchString = 'http://www.google.com/search?hl=en&lr=&safe=off&q=' + searchString;
}
if(searchEngine == 5){
finalSearchString = 'http://www.google.com/search?hl=en&lr=&safe=off&q=' + searchString;
}
if(searchEngine == 6){
finalSearchString = 'http://www.google.com/search?hl=en&q=+' + searchString;
}
if(searchEngine == 7){
finalSearchString = 'http://www.google.com/search?hl=en&lr=&safe=off&q=' + searchString;
}

location.href = finalSearchString;
}
}


// -->
</script>

<basefont face='Verdana, Arial, sans-serif'>

<form name='searchForm'>

Warez Search:<br>
<input style='background: dddddd' name='searchText' type='text'>
<br>
<select style='background: dddddd' name='whichEngine'>
<option selected>-
<option>-
<option>-
<option>-
<option>-
<option>-
<option>-
</select>
<input type='button' value='Search' onClick='startSearch()'>

</select>
</form>
Thankyou


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Oct 04, 2006 8:52 am
by volka
Is there a question? ;)

Posted: Wed Oct 04, 2006 9:08 am
by SPLITER
its not really a question.. but a request. I need someone to make/help me with my searching code.

Posted: Wed Oct 04, 2006 9:36 am
by waradmin
I would read about $_POST, and using PHP in forms. It would be a very easy change to make it php, just read up on using php with forms to pass data and assigning them to variables.

Posted: Thu Oct 05, 2006 3:48 am
by SPLITER
yeh, but i dont now how to assign drop down options n stuf. i need some help, i cant do this alone...