using a post or get array with out a submit button

using a post or get array with out a submit button

Page 1 of 1

2 Replies - 2466 Views - Last Post: 21 September 2008 - 12:17 AM Rate Topic: -----

#1 jamessy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 15-April 08

using a post or get array with out a submit button

Posted 19 September 2008 - 08:11 AM

Hi all would like to know if it is possible so that when some one clicks on a a from value it shows a ssome text else where
i can do this fine when using a submit button but is it possible so that it happens automaticly ?

<form action="" method="post">

<select name="address" id="address" >
				<option value="Brislington">Brislington</option>
				<option value="Bromborough">Bromborough</option>
				<option>Chadwell Heath</option>
</select>
<input name="submit" type="submit" value="click for details" />
</form>

<?php 


if(isset($_POST['address'])){
switch($_POST['address']){
case 'Brislington':
$title='Brislington Motorcycles';
$address= '6-8 Emery road <br>';
$address.= 'Brislington <br>';
$address .= 'Bristol <br> ';
break;

case 'Bromborough':
$title='Traders Motorcycle Centre';
$address= '16 Bassendale Road<br>';
$address.= ' Bromborough<br>';
$address .= 'Wirral<br> ';
$address .= 'ch62 3QL';
break;
}
}

echo "<div id=\"titles\"".$title ."<br />".
$address."</div>";
?>


Is This A Good Question/Topic? 0
  • +

Replies To: using a post or get array with out a submit button

#2 pemcconnell  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 54
  • View blog
  • Posts: 472
  • Joined: 05-August 08

Re: using a post or get array with out a submit button

Posted 19 September 2008 - 08:53 AM

using javascript you could implement the innerHTML :


<input type="button" name="btn" id="btn" value="show text" onclick="window.document.getElementById('myDIV').innerHTML = '<strong>hello world</strong>';" />

<div id="myDIV"></div>




note - you should put all that onlick script in a function and just call the function name.

Or, the PHP method:

Look up an AJAX tutorial :)
Was This Post Helpful? 0
  • +
  • -

#3 trotski  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 151
  • Joined: 04-September 08

Re: using a post or get array with out a submit button

Posted 21 September 2008 - 12:17 AM

Even in PHP, when you enter the value and press ENTER, the form gets processed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1