NameSilo

How to do this...

Spacemail by SpaceshipSpacemail by Spaceship
Watch

Joe

VIP Member
Impact
48
Well basically
i am trying to set up a contact
so e.g.

if it was contact.php?to=Joe

it would show the 'Joe' bit on the top of a drop down box

but heh, you're probably thinking.. yeah.. thats easy
well what i'm asking for, is for it to choose something that is already in the drop down box, it just brings it to the top
(its so people can choose who to send the email too)

ok lemme summaries

contact.php?to=Joe
shows Joe at the top

contact.php
shows a default option that cant be submitted?

contact.php?to=News
shows News at the top

anyone know how to do this?

thanks
Joe
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
PHP:
<select name="name">
<?php
if ($_GET['to'])
{
echo "<option value=\"default">
<option value='1'>Name 1";
} else
{
echo "<option value=\"$_GET['to']\">$_GET['to']
<option value='1'>Name 1";
}
?>
</select>
 
0
•••
i put it on www.artemisfowl.info/testing.php (doesn't work for me, if not try http://www.heskett.org/~artemis/testing.php)

heres the source:
Code:
<form method="post" action="test2.php">
<select name="name">
<?php
$to = $_GET['to'];
if ($_GET['to'])
{
echo "<option value=\"default\">default</option>
<option value='Jack'>Jack</option>";
} else
{
echo "<option value=\"$to\">$to</option>
<option value='Joe'>Joe</option>";
}
?>
</select>  
<input type="submit" name="submit" value="Submit">
</form>

but it doesn't work :S

Joe
 
Last edited:
0
•••
Code:
<?php
$to=$_GET['to'];
?>
<select name="name">
<option value="Joe" <?php if($to == "Joe"){ echo 'selected="selected"'; } ?> >Joe</option>
<option value="Other" <?php if($to == "Other"){ echo 'selected="selected"'; } ?> >Other</option>
</select>
That shoudl work, although it may require a bit of editing as I have not tested it, although it is the basic idea
 
Last edited:
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back