473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Selected responses on form are not picked up on 2nd php page

I have a section of code that I'm stumped on how to handle. The Selected options on the drop down menues are not being picked up on the second PHP page. That is to say the variables error, error1 & error2 on the second page remain blank. I had the same issue with other variables, but was able to fix them with $_POST, but not sure how to handle this with the query.

This form worked great on our main server, but doesn't want to work on the PHP enabled Qnap. Here is the section of script for page 1. It pulls the information from a database. It is displayed correctly on the users screen. at the bottom is page 2

Expand|Select|Wrap|Line Numbers
  1. $result19 = mysql_query("SELECT * FROM struc order by number DESC limit 1"); 
  2. $f = mysql_fetch_array($result19); 
  3. $i = 100; 
  4. $zx = 0; 
  5. for ($i =100; $i<=$f[number] ; $i +100){ 
  6. $result11 = mysql_query("SELECT * FROM catagory where number = '$i' ORDER BY catagory"); 
  7. $w = mysql_fetch_array($result11); 
  8. ?> 
  9.           <tr>  
  10.             <td width="269" bgcolor="#284357"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF"><b>  
  11.               <? 
  12. echo "$w[catagory]"; 
  13. ?> 
  14.               </b></font></td> 
  15.             <td width="47" bgcolor="#284357">  
  16.               <input type="radio" name="chk" value="<? echo $i; ?>"> 
  17.             </td> 
  18.             <td width="398" bgcolor="#284357">  
  19.               <select class=texta name="<? echo $i; ?>" onchange="changeRadio(document.forms[0].chk,this,<? echo $zx; ?>)"> 
  20.                 <option>  
  21.                 <? 
  22. $result8 = mysql_query("SELECT * FROM struc where number = '$i' ORDER BY name "); 
  23. if ($h = mysql_fetch_array($result8)) { 
  24. do{ 
  25. ?> 
  26.                <option>  
  27.                 <? echo $h[name]; ?> 
  28.                 </option> 
  29.  
  30.                 <?php 
  31.  
  32. }  
  33. while($h = mysql_fetch_array($result8));     
  34. ?> 
  35.               </select> 
  36.             </td> 
  37.           </tr> 
  38.           <? 
  39.  
  40. $zx = $zx + 1; 
  41. $i = $i + 100; 
  42. ?> 
  43.  
--------------------------------------------------------------------------------

Now the problem script on page 2
Expand|Select|Wrap|Line Numbers
  1. $result19 = mysql_query("SELECT * FROM struc order by number DESC limit 1"); 
  2. $f = mysql_fetch_array($result19); 
  3. $n = 0; 
  4. for ($i = 100; $i <= $f[number] ; $i + 100) 
  5.   if ($$i != "") 
  6.    $y[$n] = $$i;  
  7.    $n = $n + 1; 
  8. $i = $i + 100; 
  9. $error = $y[0]; 
  10. $error1 = $y[1]; 
  11. $error2 = $y[2]; 
  12.  
  13.  
  14.                 <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">1.  
  15.                   <? echo $error; ?> 
  16.                   <font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">  
  17.                   </font> </font></p> 
  18.                 <input type="hidden" name="error" value="<? echo $error; ?>"> 
  19.                 <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">2.  
  20.                   <? echo $error1; ?> 
  21.                   </font></p> 
  22.                 <input type="hidden" name="error1" value="<? echo $error1; ?>"> 
  23.                 <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">3.  
  24.                   <? echo $error2; ?> 
  25.                   </font></p> 
  26.                 <input type="hidden" name="error2" value="<? echo $error2; ?>"> 
  27.  
Sep 30 '10 #1
2 1119
Shenno
59
u had to specify value attribute in option tag..

look at example below..

Expand|Select|Wrap|Line Numbers
  1.                <option value="<? echo $h[name]; ?>">   
  2.                 <? echo $h[name]; ?>  
  3.                 </option>  
  4.  
bettween option tags u specify the string that just appear to user and not rly sent to second php page..

in option value attribute u specify the value that will be sent when that option has been selected..

hope this helps.
Oct 2 '10 #2
Thanks for the suggestion. I tried this but still had same results.

I'm thinking it has to do with the line
<select class=texta name="<? echo $i; ?>" onchange="changeRadio(document.forms[0].chk,this,<? echo $zx; ?>)">

Since $i is a number I don't know how to use $_POST to get the selected response on the second php page. Tried changing <? echo $i; ?> to test[] & on 2nd page use $test = $_POST('test'); but the 2nd page crashes after submit is pressed.
Oct 8 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Keith | last post by:
Is it possible to submit a form as soon as the page it is on loads and then redirect to another page? Thanks
5
by: bissatch | last post by:
Hi, I have been trying to come up with an idea to reduce double submissions where a user clicks refresh and, for example, another row is INSERT into a table. Originally, I would have a form...
0
by: hy | last post by:
Hi all, I got a problem to restore back the selected upload file after i fired a radio button that will call the server script to do the process. In my aspx page, i have an upload textbox to...
2
by: trebor | last post by:
If you select text in a form's textbox and then open a second form (for whatever reason), the selected text no longer looks selected; it's not hilited. When you close the second form and return to...
4
by: Lisa Jones | last post by:
Hi Can someone tell me How do you get selected date form MonthCalendar control Thanks so muc Lisa
1
by: Marcel | last post by:
Hello all, Is it possible to transfer objects derived from a class form one page to another? I made 2 testscripts: person.php ------------------------------------- <?php
1
by: imran | last post by:
Dear All, I am developing web Application using asp.net and C#(VS2005).i want to know how i can fetch menu item selected(which is desinged in master.aspx) on the other C# page (welcome.aspx.cs).
1
by: Shaun Rigby | last post by:
Hi Guys, I have been doing some research on the internet to find the answer but no joy. I have a <formin my site with a textbox and button which, when submitted, send the query to Google. ...
3
by: jmash | last post by:
Hello, The requirement is to display rows of data on a classic ASP page for rows in a recordset. On each row we have a link at the end to show detailed information about the selected row. A...
1
by: destiny007 | last post by:
can any one help me to write code to capture selected text from a page but problem is that i am not able to decide where to call the functio.in this case the function is called in all cases of mouse...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.