forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Two non vds-related questions...

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Miscellaneous
View previous topic :: View next topic  
Author Message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Fri Sep 27, 2002 8:39 pm    Post subject: Two non vds-related questions... Reply with quote

I have two questions that don't really have to do with VDS but I figured someone would probably know at least one of them anyway...

1) How can I get the text from an edit box in HTML with JavaScript?

2) I am a beginner in PHP, and I need to know how to retreive multiple parameters from a URL. (e.x.: noname.com/this.php?parameter1=hi&parameter2=bye)

I am using the following code, but it only will let me retreive one parameter and it must be in the format noname.com/this.php?parameter1:
Code:
<?
if ($QUERY_STRING == 'parameter1'){
echo "This is parameter1";
}
else{
echo "You did not enter a parameter!";
}
?>


Thanks for any help! Smile

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Fri Sep 27, 2002 8:50 pm    Post subject: Reply with quote

To question 2:

Code:

<?php
echo($parameter1);
echo($parameter2);
?>


Please note that if the magic_quotes_gpc option is set on the server, all ' and \ characters
will be automatically prefixed by a \ character by the server. To prevent the \ character
from being output, the stripslashes function could be used like this:

Code:

<?php
echo(stripslashes($parameter1));
echo(stripslashes($parameter2));
?>
Back to top
View user's profile Send private message Send e-mail Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Fri Sep 27, 2002 9:25 pm    Post subject: Reply with quote

Thanks, Tommy! Very Happy
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Fri Sep 27, 2002 9:48 pm    Post subject: Reply with quote

You're a bit brief on #1 so it's hard to tell what you're really looking for. But here's one way of obtaining the contents of an edit box:

Code:
<HTML>
<HEAD>
<script LANGUAGE="Javascript" TYPE="text/javascript">
<!--
function Validate(form)
{

  if (form.Input.value == "")
  { alert("Enter that input"); form.Input.focus(); return; }

  if (form.Input.value != "")
  { alert(form.Input.value); form.Input.focus(); return; }

}
//-->
</SCRIPT>
<TITLE>Test</TITLE>
</HEAD>

<BODY BGCOLOR="#d2d6fc" TEXT="Black" LINK="Blue" VLINK="#551A8B" ALINK="#EE0000">
<FORM Method="POST" Action="">

Input: <INPUT NAME="Input" size=40>
<HR>
<INPUT TYPE=button VALUE="Show Value" onClick="Validate(this.form)">&nbsp;  &nbsp;  &nbsp;<INPUT TYPE="reset" VALUE="Reset">
</FORM>
</BODY>
</HTML>


Greetz
Dr. Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Fri Sep 27, 2002 10:45 pm    Post subject: Reply with quote

Thanks, Dr. Dread! Exactly what I needed! Very Happy
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Fri Sep 27, 2002 11:15 pm    Post subject: PHP Reply with quote

This is basicly what I am trying to do (in VDS code):

%%page = "say this is the parameter"
if @equal(%%page,index)
info You entered the parameter!
else
warn You must enter a parameter!
end
exit

Although this PHP code does not work (I think I'm close!):

Code:
<?PHP
if ($PAGE == 'index'){
print "You have entered the \"index\" parameter.";
}
else{
print "You must enter a parameter!";
}
?>

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Fri Sep 27, 2002 11:40 pm    Post subject: Reply with quote

I think that variable names in PHP may be case sensitive. You may try this code:

Code:

<?PHP
if ($page == 'index')
    print("You have entered the \"index\" parameter.");
else
    print("You must enter a parameter!");
?>
Back to top
View user's profile Send private message Send e-mail Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sat Sep 28, 2002 2:09 pm    Post subject: Reply with quote

Thanks Tommy... Very Happy
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Miscellaneous All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group