4 Replies - 4170 Views - Last Post: 27 May 2009 - 05:40 PM Rate Topic: -----

#1 kunkka  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 99
  • Joined: 15-May 09

how to check selectediteme in combo box

Posted 22 May 2009 - 06:59 PM

this is what i want to do. when you select one from the list. it should save to that table.

like im planing to create Student table + Lectuerer table

so when the user select Student in combobox . and then fill the form and submit it should goes to that table.

how to do it
Is This A Good Question/Topic? 0
  • +

Replies To: how to check selectediteme in combo box

#2 kunkka  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 99
  • Joined: 15-May 09

Re: how to check selectediteme in combo box

Posted 22 May 2009 - 11:41 PM

no help :S
Was This Post Helpful? 0
  • +
  • -

#3 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Re: how to check selectediteme in combo box

Posted 23 May 2009 - 12:10 AM

k here what is needed first you create your main page and one combo box and add Students and Lecturer such as
<form id="form1" name="form1" method="post" action="">
  <label>
  <select name="select" id="select">
    <option value="Student">Student</option>
    <option value="Lecturer">Lecturer</option>
  </select>
  </label>
  <br />
  <br />
  <table width="500" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td colspan="5">Table</td>
    </tr>
  </table>
  <p>
    <label>
    <input type="submit" name="button" id="button" value="Submit" />
    </label>
  </p>
  <p>&nbsp;</p>
</form>


and then a receive.php page and type the following code
<?php
<?php
if(isset($_POST['select']))
{
$page = $_POST['select'];
if($page=="Student")
{
//Insert into Student Table
}
else
{
// Insert into Lecturer Table
}
}
?>


~Noor Ahmad~
Was This Post Helpful? 0
  • +
  • -

#4 no2pencil  Icon User is online

  • Toubabo Koomi
  • member icon

Reputation: 5313
  • View blog
  • Posts: 27,213
  • Joined: 10-May 07

Re: how to check selectediteme in combo box

Posted 23 May 2009 - 07:48 PM

View Postkunkka, on 23 May, 2009 - 12:41 AM, said:

no help :S

This is a great example on how not to get help...

When working with PHP & Javascript, you'll need to parse the results back through PHP.
Was This Post Helpful? 0
  • +
  • -

#5 K4pT3N  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 25-May 09

Re: how to check selectediteme in combo box

Posted 27 May 2009 - 05:40 PM

or you can use this script
<select name="type_user" onchange="window.open('receive.php?type_user='+this.value,'_top');">
<option value="1">Student</option>
<option value="2">Lecturer</option>
</select>



and in receive.php
<?
	$type_user = $_POST['type_user'];
	switch($type_user)
	{   case 1;
			  {  //Insert into Student Table } break;
		 case 2;
			  {  // Insert into Lecturer Table } break;
	}
?>


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1