Jump to content

noob question


Devon11

Recommended Posts

my problem is that i don't know how to use "?" and "&" ,in a page link , or what exactly they do

can you explain me a bit?

 

what i want to do is a dinamic page for users; let's say that i have a page with member list from my site , and when i click a name to go to a page where i can find some info about that member

i can use a single page script for all of the members , right? who do i do that?

 

Link to comment
https://forums.phpfreaks.com/topic/141104-noob-question/
Share on other sites

? specifies the beginning of the query string in the URL. the format is this:

 

http://www.yoursite.com/file.php?variable1=value1&variable2=value2&variable3=value3

 

the & symbol delimits each variable and value pair. file.php, in the example above, would then have the following variables available:

 

$_GET['variable1']
$_GET['variable2']
$_GET['variable3']

 

with the values 'value1', 'value2', and 'value3' respectively.

Link to comment
https://forums.phpfreaks.com/topic/141104-noob-question/#findComment-738525
Share on other sites

And if you use method="get" in your html form, the url will be automatically constructed for you.

 

Ex:

<form action="whatever.php" method="get">
   <input type="text" name="variable1" value="value1" />
   <input type="submit" name="submit" value="Submit" />
</form>

 

Submitting the above form will create the following url:

whatever.php?variable1=value1&submit=Submit

 

Does that help clear things up?

Link to comment
https://forums.phpfreaks.com/topic/141104-noob-question/#findComment-738530
Share on other sites

and then i put ...

if(!isset($_GET['variable'])) $_GET['variable'] = '';
switch($_GET['variable'])
{
case  '':
<form action="whatever.php" method="get">
   <input type="text" name="variable" value="value" />
   <input type="submit" name="submit" value="Submit" />
</form>
break;

case 'value':
//something else
break;
}

...??

Link to comment
https://forums.phpfreaks.com/topic/141104-noob-question/#findComment-738549
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.