| View previous topic :: View next topic |
| Author |
Message |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Fri Sep 27, 2002 8:39 pm Post subject: Two non vds-related questions... |
|
|
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¶meter2=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!  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Fri Sep 27, 2002 8:50 pm Post subject: |
|
|
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 |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Fri Sep 27, 2002 9:25 pm Post subject: |
|
|
Thanks, Tommy!  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Fri Sep 27, 2002 9:48 pm Post subject: |
|
|
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)"> <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 |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Fri Sep 27, 2002 10:45 pm Post subject: |
|
|
Thanks, Dr. Dread! Exactly what I needed!  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Fri Sep 27, 2002 11:15 pm Post subject: PHP |
|
|
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 |
|
 |
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Fri Sep 27, 2002 11:40 pm Post subject: |
|
|
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 |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sat Sep 28, 2002 2:09 pm Post subject: |
|
|
Thanks Tommy...  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
|