Javascript to PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
SPLITER
Forum Newbie
Posts: 3
Joined: Wed Oct 04, 2006 7:56 am

Javascript to PHP

Post 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]
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Is there a question? ;)
SPLITER
Forum Newbie
Posts: 3
Joined: Wed Oct 04, 2006 7:56 am

Post by SPLITER »

its not really a question.. but a request. I need someone to make/help me with my searching code.
User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

Post 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.
SPLITER
Forum Newbie
Posts: 3
Joined: Wed Oct 04, 2006 7:56 am

Post by SPLITER »

yeh, but i dont now how to assign drop down options n stuf. i need some help, i cant do this alone...
Post Reply