[SOLVED] Text Box Entry problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
NotOnUrNelly
Forum Commoner
Posts: 61
Joined: Wed Mar 24, 2004 4:45 pm

[SOLVED] Text Box Entry problem

Post by NotOnUrNelly »

Hi All,

Just quick one here,

I have a submission form with a number of text boxes.

http://www.runthelakes.co.uk/ale/adminp ... p?pubid=22

If I enter the first text box on the page (title1) I cannot click anywhere along the length of the box and select the box. I have to click where the text already exists.

If the text box is empty (try it if you like) I then have to go to the very begining of the text box to get my cursor flashing within the textbox. Where If I try to enter the text box half way along It does not become selectable.

The others on the form are fine and can be selected at any point.except the first two. Does anyone know why this might be

Many Thanks
Jamie
Last edited by NotOnUrNelly on Thu Nov 02, 2006 6:39 am, edited 1 time in total.
User avatar
blacksnday
Forum Contributor
Posts: 252
Joined: Sat Jul 30, 2005 6:11 am
Location: bfe Ohio :(

Post by blacksnday »

Posting your code here is the best way for us to help fix your problem
NotOnUrNelly
Forum Commoner
Posts: 61
Joined: Wed Mar 24, 2004 4:45 pm

Post by NotOnUrNelly »

No Worries here is the code for the form.

Nothing seems to be any diffeent for the first two text boxes that cant be selected to any of the others that can be selected.

Uhm

Thanks

Code: Select all

<div id="pubPage1" style="position:absolute; left:157; top:165; width:576px; height:115px; z-index:2"> 
  <form action="<?php echo $editFormAction; ?>" method="POST" name="page1" id="page1">
    <table width="533" border="0" cellspacing="2" cellpadding="0">
      <tr> 
        <td colspan="2"><font color="#FF0000" size="3" face="Arial, Helvetica, sans-serif"><strong>Main 
          Page </strong></font> </td>
        <td width="343"><input name="user_id2" type="hidden" id="user_id22" value="<?php echo $row_rstPub['user_id']; ?>"> 
          <input name="pub_id2" type="hidden" id="pub_id22" value="<?php echo $row_rstPub['pub_id']; ?>"> 
          <input name="junkno" type="hidden" id="junkno"> </td>
      </tr>
      <tr> 
        <td width="109">&nbsp;</td>
        <td colspan="2">&nbsp;</td>
      </tr>
      <tr> 
        <td valign="top">Title 1</td>
        <td colspan="2"><input name="title1" type="text" size="50" value="<?php echo $row_rstMainPage['title1']; ?>"></td>
      </tr>
      <tr> 
        <td valign="top">Content 1</td>
        <td colspan="2"><textarea name="about" cols="50" rows="5" id="about"><?php echo $row_rstMainPage['about']; ?></textarea></td>
      </tr>
      <tr> 
        <td valign="top">Title 2</td>
        <td colspan="2"><input name="title2" type="text" value="<?php echo $row_rstMainPage['title2']; ?>" size="50"></td>
      </tr>
      <tr> 
        <td valign="top">Content 2</td>
        <td colspan="2"><textarea name="history" cols="50" rows="5" id="history"><?php echo $row_rstMainPage['history']; ?></textarea></td>
      </tr>
      <tr>
        <td valign="top">Title 3</td>
        <td colspan="2"><input name="title3" type="text" size="50" value="<?php echo $row_rstMainPage['title3']; ?>"></td>
      </tr>
      <tr> 
        <td valign="top">Content 3</td>
        <td colspan="2"><textarea name="future" cols="50" rows="5" id="future"><?php echo $row_rstMainPage['futureplans']; ?></textarea></td>
      </tr>
      <tr> 
        <td>Main Picture</td>
        <td width = "60"><input name="picture" type="text" id="picture" value="<?php echo $row_rstMainPage['picture']; ?>" size="40"> 
        </td><td>
<?php
   $Button = '<img src=\'images/'.oales.'.gif\' alt="Add Image" width="30" height="30" border=0>';
//   echo $Button;
$ImageType = "Pub";
$url = 'image_upload.php?pubid='.$pubid.'&ImageType='.$ImageType.'';
do_pop_url($url,$Button);
echo '</div></td><td width = "6%"></td></tr><tr></tr></table>';

function do_pop_URL($url,$name)
{
?><a href="javascript:;" onClick="MM_openBrWindow('<?php echo $url;?>','template','width=600,height=300, left=100,top=100')" target="_self"> 
<?php echo $name; ?> 
<?php
}?>
</td>
      </tr>
      <tr> 
        <td>&nbsp;</td>
        <td colspan="2"><input name="Update2" type="submit" id="Update22" value="Update"> 
        </td>
      </tr>
    </table>
  
    <input type="hidden" name="MM_update2" value="page1">
  </form>
</div>
User avatar
blacksnday
Forum Contributor
Posts: 252
Joined: Sat Jul 30, 2005 6:11 am
Location: bfe Ohio :(

Post by blacksnday »

the exact code you posted DOES work correctly.
(tested on localhost and all input/text boxes allow for input)

It must be something in your code other then what was posted that is preventing it
NotOnUrNelly
Forum Commoner
Posts: 61
Joined: Wed Mar 24, 2004 4:45 pm

Post by NotOnUrNelly »

Uhm,

does the web link I sent you work, the page was originally created using dreamweaver wizards. I then started to modify the code.

the whole page is posted here.

Code: Select all

<?php
session_start();
 require_once('Connections/wain.php');
require_once('navpubadmin.php');

 ?>
 <script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<?php

$pubid = $HTTP_GET_VARS['pubid'];
echo $pubid;

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "pub")) {
  $updateSQL = sprintf("UPDATE alePubs SET user_id=%s, pub_name=%s, slogan=%s, pub_address1=%s, town=%s, county_id=%s, landlord=%s, telephone=%s, email=%s, website=%s, brewery=%s WHERE pub_id=%s",
                       GetSQLValueString($HTTP_POST_VARS['user_id'], "int"),
                       GetSQLValueString($HTTP_POST_VARS['pub_name'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['slogan'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['address'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['town'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['county'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['textfield2'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['telephone'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['email'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['website'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['brewery'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['pub_id'], "int"));

  mysql_select_db($database_wain, $wain);
  $Result1 = mysql_query($updateSQL, $wain) or die(mysql_error());
}

if ((isset($HTTP_POST_VARS["MM_update2"])) && ($HTTP_POST_VARS["MM_update2"] == "page1")) {
  $updateSQL = sprintf("UPDATE aleMainPage SET userid=%s, about=%s, history=%s, futureplans=%s,title1=%s,title2=%s,title3=%s, picture=%s WHERE pubid=%s",
                       GetSQLValueString($HTTP_POST_VARS['user_id2'], "int"),
                       GetSQLValueString($HTTP_POST_VARS['about'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['history'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['future'], "text"),
					      GetSQLValueString($HTTP_POST_VARS['title1'], "text"),
						     GetSQLValueString($HTTP_POST_VARS['title2'], "text"),
							    GetSQLValueString($HTTP_POST_VARS['title3'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['picture'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['pub_id2'], "int"));

  mysql_select_db($database_wain, $wain);
  $Result1 = mysql_query($updateSQL, $wain) or die(mysql_error());
//  echo $updateSQL;
}



$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
echo $HTTP_SESSION_VARS['pubid'];
echo $HTTP_SESSION_VARS['user'];


mysql_select_db($database_wain, $wain);
$query_rstPub = sprintf("SELECT * FROM alePubs WHERE pub_id = '$pubid'");
$rstPub = mysql_query($query_rstPub, $wain) or die(mysql_error());
$row_rstPub = mysql_fetch_assoc($rstPub);
$totalRows_rstPub = mysql_num_rows($rstPub);

mysql_select_db($database_wain, $wain);
$query_rstRegion = "SELECT * FROM aleRegions ORDER BY region_name ASC";
$rstRegion = mysql_query($query_rstRegion, $wain) or die(mysql_error());
$row_rstRegion = mysql_fetch_assoc($rstRegion);
$totalRows_rstRegion = mysql_num_rows($rstRegion);

$colname_rstMainPage = "1";
if (isset($HTTP_SESSION_VARS['pubid'])) {
  $colname_rstMainPage = (get_magic_quotes_gpc()) ? $HTTP_SESSION_VARS['pubid'] : addslashes($HTTP_SESSION_VARS['pubid']);
}
mysql_select_db($database_wain, $wain);
$query_rstMainPage = sprintf("SELECT * FROM aleMainPage WHERE pubid = '$pubid'");
$rstMainPage = mysql_query($query_rstMainPage, $wain) or die(mysql_error());
$row_rstMainPage = mysql_fetch_assoc($rstMainPage);
$totalRows_rstMainPage = mysql_num_rows($rstMainPage);

mysql_select_db($database_wain, $wain);
$query_rstAbout = sprintf("SELECT * FROM aleMainPage WHERE pubid = '$pubid'");
$rstAbout = mysql_query($query_rstAbout, $wain) or die(mysql_error());
$row_rstAbout = mysql_fetch_assoc($rstAbout);
$totalRows_rstAbout = mysql_num_rows($rstAbout);
?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>

<body>
<div id="pubPage1" style="position:absolute; left:157; top:165; width:576px; height:115px; z-index:2"> 
  <form action="<?php echo $editFormAction; ?>" method="POST" name="page1" id="page1">
    <table width="533" border="0" cellspacing="2" cellpadding="0">
      <tr> 
        <td colspan="2"><font color="#FF0000" size="3" face="Arial, Helvetica, sans-serif"><strong>Main 
          Page </strong></font> </td>
        <td width="343"><input name="user_id2" type="hidden" id="user_id22" value="<?php echo $row_rstPub['user_id']; ?>"> 
          <input name="pub_id2" type="hidden" id="pub_id22" value="<?php echo $row_rstPub['pub_id']; ?>"> 
          <input name="junkno" type="hidden" id="junkno"> </td>
      </tr>
      <tr> 
        <td width="109"><?php echo $HTTP_SESSION_VARS['PubID'];?></td>
        <td colspan="2">&nbsp;</td>
      </tr>
      <tr> 
        <td valign="top">Title 1</td>
        <td colspan="2"><input name="title1" type="text" size="50" value="<?php echo $row_rstMainPage['title1']; ?>"></td>
      </tr>
      <tr> 
        <td valign="top">Content 1</td>
        <td colspan="2"><textarea name="about" cols="50" rows="5" id="about"><?php echo $row_rstMainPage['about']; ?></textarea></td>
      </tr>
      <tr> 
        <td valign="top">Title 2</td>
        <td colspan="2"><input name="title2" type="text" value="<?php echo $row_rstMainPage['title2']; ?>" size="50"></td>
      </tr>
      <tr> 
        <td valign="top">Content 2</td>
        <td colspan="2"><textarea name="history" cols="50" rows="5" id="history"><?php echo $row_rstMainPage['history']; ?></textarea></td>
      </tr>
      <tr>
        <td valign="top">Title 3</td>
        <td colspan="2"><input name="title3" type="text" size="50" value="<?php echo $row_rstMainPage['title3']; ?>"></td>
      </tr>
      <tr> 
        <td valign="top">Content 3</td>
        <td colspan="2"><textarea name="future" cols="50" rows="5" id="future"><?php echo $row_rstMainPage['futureplans']; ?></textarea></td>
      </tr>
      <tr> 
        <td>Main Picture</td>
        <td width = "60"><input name="picture" type="text" id="picture" value="<?php echo $row_rstMainPage['picture']; ?>" size="40"> 
        </td><td>
<?php
   $Button = '<img src=\'images/'.oales.'.gif\' alt="Add Image" width="30" height="30" border=0>';
//   echo $Button;
$ImageType = "Pub";
$url = 'image_upload.php?pubid='.$pubid.'&ImageType='.$ImageType.'';
do_pop_url($url,$Button);
echo '</div></td><td width = "6%"></td></tr><tr></tr></table>';

function do_pop_URL($url,$name)
{
?><a href="javascript:;" onClick="MM_openBrWindow('<?php echo $url;?>','template','width=600,height=300, left=100,top=100')" target="_self"> 
<?php echo $name; ?> 
<?php
}?>
</td>
      </tr>
      <tr> 
        <td>&nbsp;</td>
        <td colspan="2"><input name="Update2" type="submit" id="Update22" value="Update"> 
        </td>
      </tr>
    </table>
  
    <input type="hidden" name="MM_update2" value="page1">
  </form>
</div>
</body>
</html>
<?php
mysql_free_result($rstPub);

mysql_free_result($rstRegion);

mysql_free_result($rstMainPage);
?>
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

blacksnday is wrong, it doesn't work properly. The problem is that this div ...

Code: Select all

<div id="Layer1" style="position:absolute; left:230px; top:172px; width:241px; height:139px; z-index:11">



</div>
... is sitting on top of the form and not letting you click on the text entry boxes for the first couple of items.
User avatar
blacksnday
Forum Contributor
Posts: 252
Joined: Sat Jul 30, 2005 6:11 am
Location: bfe Ohio :(

Post by blacksnday »

onion2k wrote:blacksnday is wrong, it doesn't work properly. The problem is that this div ...

Code: Select all

<div id="Layer1" style="position:absolute; left:230px; top:172px; width:241px; height:139px; z-index:11">



</div>
... is sitting on top of the form and not letting you click on the text entry boxes for the first couple of items.
On my localhost using first source code he gave, using IE 7 and FF 1.5.07 it worked just fine for me.
Last edited by blacksnday on Thu Nov 02, 2006 6:39 am, edited 1 time in total.
NotOnUrNelly
Forum Commoner
Posts: 61
Joined: Wed Mar 24, 2004 4:45 pm

Post by NotOnUrNelly »

Ah Brill Thanks,

That layer was actually in an include file.

Something I must watch out for.

Thanks again all involved

Jamie
Post Reply