Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old February 20th, 2004, 12:38 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
2 Forms in 1 page

Hello everyone,

newbie question:

is it possible to use the value of a dropbox form (from 'SELECT') in 2 different submit forms? I have a page that consists of 'SEARCH' form and 'ADD' form and a dropdown SELECT a database menu form.

I would like to use the value of selected database from a dropdow menu to process both forms. If SEARCH form is press it will check entry for a 'KEYWORD' and the SELECTED database, but if 'ADD' is pressed it will only check the SELECTED database and redirect the page to another page.

Error:

the SELECTED database is not being pass when I click on the 'ADD' button.

=====below is how i tried to implement it, please check ====


php Code:
Original - php Code
  1.  
  2.  
  3. <?php
  4.  
  5. select_database();
  6.  
  7. function select_database(){
  8.  
  9.  
  10.     echo "<form method="post" action="nocswmain2.php">";
  11.     echo "<table align ="center" border="0" cellspacing="0" cellpadding="1">";
  12.  
  13.     echo "<td>NOCSW Database </td>";
  14.     echo "<td>";
  15.     echo "<select name="database">";
  16.     echo "<option value="0">Select Database</option>";
  17.     echo "<option>Point Code</option>";
  18.         echo "<option>Trunk Group</option>";
  19.         echo "<option>Signalling Link</option>";
  20.     echo "<option>Signalling Routeset</option>";
  21.     echo "<option>Procedure NOCSW</option>";
  22.     echo "</select>";
  23.     echo "</td>";
  24.  
  25.     echo "<td>";
  26.     echo "<input name="search_keyword">";
  27.     echo "</td>";
  28.  
  29.     echo "<td>";
  30.         echo "<input type="submit" value="Search">";
  31.         echo "<input type="reset"  value="Reset">";
  32.     echo "</td>";
  33.     echo "</form>";
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. }
  42. ?>
  43.  
  44. <?php
  45.     echo "<form method="post" action="adddb.php">";
  46.     echo "<td>";
  47.     echo "<input type="hidden" name="upddb">";
  48.     echo "</td>";
  49.     echo "<input type="submit" value="Add">";
  50.     echo "</form>";
  51.     echo "<hr />";
  52.  
  53. ?>
  54.  


Reply With Quote
  #2  
Old February 20th, 2004, 02:30 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: 2 Forms in 1 page

Only the information form that is submitted is sent to the next page. What you would need to do is use javascript to assign the selected db to a hidden field in the second form. a couple things you need to remember, is that

1. you must give each of the forms a different name.
2. Check to make sure that the selected db hidden field in the second form contains a value before running your query

us an onChange event in the dropdown to trigger the population of the hidden field in the second form

Reply With Quote
  #3  
Old February 20th, 2004, 11:47 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: 2 Forms in 1 page

helo thanks for the reply...

is there a way to implement this without using javascript since i haven't come across javascripting at all.


again, thanks for the reply.




Reply With Quote
  #4  
Old February 21st, 2004, 02:21 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: 2 Forms in 1 page

Really the only way to accomplish this is with JavaScript! you would need to use an onChange event in the select box that set the value of a hidden field in the second form.

try doing a little research and if you need some assistance at that point let me know.

search for Javascript onChange events using SELECT Boxes

Reply With Quote
  #5  
Old February 28th, 2004, 09:44 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: 2 Forms in 1 page

hi Blindeddie,

i have modified my form but still needs the functionality i mentioned in my first post.

this time the page has submit buttons for add/update/delete/reset that i would like to

assign 'action' according to its function.

as i have zero knowledge in javascript and just starting to learn php could please

guide me on how to implement your suggestion.

please find below my php script for the page, at the last part of the scri[t where it

used 'isset' fucntion is the suggestion that i got from other group which currentlt

the doesnt work.


thanks again for your reply.

[highlight=php]
<?php

//edit form for pc database


$z = $_GET['x'];

include ("conn_inc.php");

$query = "select * from pc where pcnum = '$z'";
$mysql_result=mysql_query($query,$conn);
$pc=mysql_fetch_array($mysql_result);

mysql_close($conn);

?>




<html>
<head>
<body>

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">


<table align = "center" border="1" cellpadding="2" cellspacing="0">

<tr>
<td align="center" colspan="2">POINT CODE EDIT FORM</td>
</tr>
<br>
<br>
<tr>
<td>Node Site</td>
<td>
<?php

echo "<input type="text" name="nodesite" value="". $pc['nodesite'];
echo "">";

?>
</td>
</tr>
<tr>
<td>Node Type</td>
<td>
<?php

echo "<input type="text" name="nodetype" value="". $pc['nodetype'];
echo "">";

?>
</td>
</tr>
<tr>
<td>Node Site</td>
<td>
<?php

echo "<input type="text" name="nodeclli" value="". $pc['nodeclli'];
echo "">";

?>
</td>
</tr>
<tr>
<td>ANSI Format</td>
<td>
<?php

echo "<input type="text" name="ansi" value="". $pc['ansi'];
echo "">";

?>

</td>
</tr>
<tr>
<td>CCITT Format</td>
<td>
<?php

echo "<input type="text" name="ccitt" value="". $pc['ccitt'];
echo "">";

?>

</td>
</tr>
<tr>
<td>HEX Format</td>
<td>
<?php

echo "<input type="text" name="hex" value="". $pc['hex'];
echo "">";

?>

</td>
</tr>
<tr>
<td>Comments</td>
<td>
<?php

echo "<input type="text" name="comments" value="". $pc['comments'];
echo "">";

?>

</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type=submit name="add" value="Add" >
<input type=submit name="delete" value="Delete" >
<input type=submit name="update" value="Update" >
<input type=reset name="clear" value="Clear" >
</td>
</tr>
</form>



<?php
if (isset($POST['add'])) {

echo "database will be added";

}

if (isset($POST['delete'])) {

echo "database will be deleted";

}

if (isset($POST['update'])) {

echo "database will be updated";

}




?>







</body>
</head>
</html>

Reply With Quote
  #6  
Old February 29th, 2004, 02:28 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: 2 Forms in 1 page

hello,

this seems to be working now, i made an syntax error in the script.

[highlight=php]

if (isset($POST['add'])) {

echo "database will be added";

}

shld be



if (isset($_POST['add'])) {

echo "database will be added";

}

[highlight=php]

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > 2 Forms in 1 page


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT