Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Nov 2006
    Location
    Malvern, PA
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Variable working in Firefox but not IE

    I have the following code which works in Firefox but not in Explorer.
    For some reason the $tabsel variable is not being passed correctly.
    If I echo $tabsel it displays in Firefox but not Explorer.
    The reason I am confused is that the rest of the variables are being passed correctly.

    Thanks for your help.


    PHP Code:
    <?php
    include 'config.php';
    include 
    'opendb.php';

    $ud_id=$HTTP_POST_VARS['ud_id'];
    $ud_tname=$HTTP_POST_VARS['ud_tname'];
    $ud_contact1=$HTTP_POST_VARS['ud_contact1'];
    $ud_phone1A=$HTTP_POST_VARS['ud_phone1A'];
    $ud_phone1B=$HTTP_POST_VARS['ud_phone1B'];
    $ud_email1=$HTTP_POST_VARS['ud_email1'];
    $ud_contact2=$HTTP_POST_VARS['ud_contact2'];
    $ud_phone2A=$HTTP_POST_VARS['ud_phone2A'];
    $ud_phone2B=$HTTP_POST_VARS['ud_phone2B'];
    $ud_email2=$HTTP_POST_VARS['ud_email2'];
    $ud_date=$HTTP_POST_VARS['ud_date'];
    $ud_misc=$HTTP_POST_VARS['ud_misc'];

    // **** Here's the problem  *****
    $tabsel=$HTTP_POST_VARS['sorttab'];


    $query="UPDATE $tabsel SET tname='$ud_tname', contact1='$ud_contact1', phone1A='$ud_phone1A', phone1B='$ud_phone1B', email1='$ud_email1', contact2='$ud_contact2', phone2A='$ud_phone2A', phone2B='$ud_phone2B', email2='$ud_email2', misc='$ud_misc' ,date='$ud_date' WHERE reg_id='$ud_id'";
    mysql_query($query);
    echo 
    "Record Updated";

    echo 
    phpinfo();
     echo 
    "<br> {$query}" ;
     echo 
    "<br> {$tabsel}" 
    mysql_close();

    include 
    'closedb.php';

    ?>

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    2,958
    Thanks
    2
    Thanked 304 Times in 296 Posts
    Your form probably contains invalid markup and is interpreted differently between the two browsers.

    Post your form code to get specific help with what it might be doing.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    New Coder
    Join Date
    Nov 2006
    Location
    Malvern, PA
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks for the response. I suspected the form, particularly the hidden input fields, but the $id field works so I moved on.

    Here's the form:

    Code:
    <!-- Code Update Formatting --->
    <link rel="stylesheet" type="text/css" href="register.css" />
    <form action="ADLTupdated.php" method="post">
    <input type="hidden" name="ud_id" value="<? echo $id; ?>">
    <table>
    	<tr>
    		<td class="odd">Team Name: </td>
    		<td colspan="2" class="odd">
    		<input type="text" name="ud_tname" size="30" value="<? echo $tname; ?>"></td>
    	</tr>
    	
    	<tr>
    		<td class="even">Session:</td>
    		 <td colspan="2" class="even">I:&nbsp;
    		 <input type="text" name="ud_sess_one" size="5" value="<? echo $sess_one; ?>">&nbsp;II:&nbsp;<input type="text" name="ud_sess_two" size="5" value="<? echo $sess_two; ?>"></td>
    	</tr>
    
    	<tr>
    		<td class="odd">First Contact:</td>
    		<td colspan="2" class="odd">
    		<input type="text" name="ud_contact1" size="40" value="<? echo $contact1; ?>"></td>
    	</tr>	
    
    	<tr>
    		<td class="even"></td>
    		<td class="even">Phone:&nbsp;
    			<input type="text" name="ud_phone1A" size="17" value="<? echo $phone1A; ?>">
    		</td>
    		<td class="even">
    			<input type="text" name="ud_phone1B" size="17" value="<? echo $phone1B; ?>">
    		</td>
    	</tr>
    	
    	<tr>
    		<td class="odd"></td>
    		<td colspan="2" class="odd">Email:&nbsp;
    			<input type="text" name="ud_email1"  size="40" value="<? echo $email1; ?>">
    		</td>
    	</tr>
    
    	<tr>
    		<td class="even">Second Contact:</td>
    		 <td colspan="2" class="even">
    		 	<input type="text" name="ud_contact2"  size="40" value="<? echo $contact2; ?>">
    		 </td>
    	</tr>
    
    	<tr>
    		<td class="odd"></td>
    		<td class="odd">Phone:&nbsp;
    			<input type="text" name="ud_phone2A"  size="17" value="<? echo $phone2A; ?>">
    		</td>
    		<td class="odd">
    			<input type="text" name="ud_phone2B"  size="17" value="<? echo $phone2B; ?>">
    		</td>
    	</tr>
    	
    	<tr>
    		<td class="even"></td>
    		<td  colspan="2" class="even">Email:&nbsp;
    			<input type="text" name="ud_email2"  size="40" value="<? echo $email2; ?>">
    		</td>
    	</tr>
    	
    	<tr>
    		<td  class="odd">Registration Date:</td>
    		<td  colspan="2" class="odd">
    			<input type="text" name="ud_date"  size="40" value="<? echo $date; ?>">
    		</td>
    	</tr>
    	
    	<tr>
    		<td class="even">Notes:</td>
    		<td colspan="2" class="even">
    			<textarea name="ud_misc" rows="5" cols="40"> <? echo $misc; ?></textarea>
    		</td>
    	</tr>
    </table
    <input type="hidden" name="sorttab" value="<? echo $tabsel; ?>">
    <input type="Submit" value="Update">
    </form>

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    2,958
    Thanks
    2
    Thanked 304 Times in 296 Posts
    The </table> tag is missing the > and is preventing the browser from seeing the sorttab input field.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #5
    New Coder
    Join Date
    Nov 2006
    Location
    Malvern, PA
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts


    Thanks

  • #6
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    Also, you should be using $_GET and $_POST, $HTTP_POST_VARS is outdated and will soon stop working (PHP6 I believe).


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •