473,625 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I have to click a search button twice in order to get the results when the file loads

6 New Member
My site is programmed with php and javascript. I have a search button which it searches records from my database. I have two different programming codes into the same file which retrieve data, the first one retrieves emails in the text area and the other retrieves names and other details. The one which retrieves emails work fine but the other doesn’t retrieve data until I click search button twice when the file first loads. After clicking the search button twice at the first time, the problem disappears and it works fine for the rest of the searches. The one which retrieves email is programmed with pure php but the other actually uses javascript (updateDIV()) and pull other php file. It gets the userid first and then uses that userid to fetch other records. Below is the sample code
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. onclick="updateDIV('viewcontact.php?UID=<?php echo $user['contactID'];?>&format=detail~user<?php echo $user['contactID'];?>content');">
  3. ?>
Apr 13 '12 #1
2 2683
johny10151981
1,059 Top Contributor
is this your actual code?

any way the url you are sending is something like below

viewcontact.php ?UID=contactID&format=detail~ usercontactID']content

my question is was this suppose to be like this?
Apr 14 '12 #2
Pamr
6 New Member
viewcontact.php is the php file which displays the name and other details in my database. There is a case statement in viewcontact.php file which displays the info when format is equal to details.. see below the codes of viewcontact.php file: I think it will help you to understand the meaning of that string of code.
<?php
switch($_REQUES T['format'])
{
case "detail":
?>
<tr>
<td valign="top" rowspan=2><img src="images/triangle_redS.g if" onclick="update DIV('viewcontac t.php?UID=<?php echo $user['contactID'];?>&format=shor t~user<?php echo $user['contactID'];?>content');"> <!-- <b>#<?php echo $usernum;?></b>--></td>
<td valign="top"><i mg src="images/spacer.gif" width=250 height=1><br><b ><?php echo $user['namefirst']." ".$user['namelast'];?></b>&nbsp;<br>
<?php echo $user['address1'];?>&nbsp;<br>
<?php echo $user['city'].", ".$user['state'];?>&nbsp;&nbsp; <?php echo $user['zip'];?>&nbsp;<br>
<a href="mailto:<? php echo $user['email1'];?>"><?php echo $user['email1'];?></a>&nbsp;<br>
<?php
if ($user['phone1BadYN']==1) { echo "<b><i><spa n style='color: #990000;'>BAD: "; }
echo formatPhone($us er['phone1'])." - ".$user['phone1type'];
if ($user['phone1BadYN']==1) { echo "</span></i></b>"; }
?>&nbsp;<br>

<?php if (!($_SESSION["email1"] == "sean@westcoast mortgage.biz")) { echo "Password: ".$user['webUserPasswor d']."&nbsp;<br />";}?>
Referred by: <?php echo ucwords($user['findus']);?>&nbsp;<br />
Signed Buyer Agreement? <?php echo $user['webUserAgreeme nt'];?>&nbsp;<br />

</td>
<td valign="top" colspan=2 align="left"><i mg src="images/spacer.gif" width=400 height=1><br><b ><?php echo date("m/d/y h:i", strtotime($user['webUserAddedOn '])).strtolower(s ubstr(date("A", strtotime($user['webUserAddedOn '])),0,1))." (".$user['webUserRegSite ']." - Registered On)";?></b>
<div style="height: 100px; overflow:auto; border-top: 1px solid #ddd;">
<?php
$mySQL = "SELECT SiteID, Visit_DT from site_logins WHERE UserID = '".$_REQUEST['UID']."' ORDER BY Visit_DT DESC";
$userlogins = mysql_query($my SQL);
while ($userlogin = mysql_fetch_arr ay($userlogins) ) {
$mySQL = "SELECT Count(*) AS LoginCount FROM site_logins WHERE SiteID = '".$userlogi n['SiteID']."' AND UserID = '".$_REQUEST['UID']."'";
$logincount = mysql_query($my SQL);
$count = mysql_fetch_arr ay($logincount) ;
echo date("m/d/y h:i", strtotime($user login['Visit_DT'])).strtolower(s ubstr(date("A", strtotime($user login['Visit_DT'])),0,1))." (".$userlogi n['SiteID']." Login - ".$count['LoginCount']." Total)<br />";
}
?></div>
</td>
<td valign="top" align="center"> <img src="images/spacer.gif" width=60 height=1><br><a href="#" onclick="update DIV('editcontac t.php?UID=<?php echo $user['contactID'];?>~user<?php echo $user['contactID'];?>content');re turn false;" style="color: #000000; font-size: 8pt; font-weight: bold; text-decoration: none;"><img src="images/user_write_32.g if" width=32 height=32 border=0><br>ED IT</a><br />
<img src="images/spacer.gif" width=60 height=1><br><a href="printdeta ils.php?UID=<?p hp echo $user['contactID'];?>" target="_blank" style="color: #000000; font-size: 8pt; font-weight: bold; text-decoration: none;"><img src="images/print_24.gif" border=0><br> PRINT</a>

<img src="images/spacer.gif" width=60 height=1><br><a href="#" onclick="if(con firm('Do you really want to delete this user?'))
{
updateDIV('dele tecontact.php?U ID=<?php echo $user['contactID'];?>~user<?php echo $user['contactID'];?>content');
}
else{
return false;
} " style="color: #000000; font-size: 8pt; font-weight: bold; text-decoration: none;"><img src="images/user_close_32.g if" width=32 height=32 border=0><br>DE LETE</a>

</td></tr>
<tr>
<td colspan=10 style='border-bottom: solid 1px #cccccc;'><b>NO TES:</b> <?php echo $user['notes'];?><div style="line-height: 1px; font-size: 1px;">&nbsp;</div></td>
</tr>
</table>
<?php
break;

?>
Apr 17 '12 #3

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

Similar topics

2
2680
by: Danny Wang | last post by:
HI, I have a dialog (window) with a drop-down list and an OK button. When user clicks the drop-down list, the app need to do some calculation and validation, so I put an Text_on_change event on the drop-down. When click OK the dialog should be closed; however, if the user already clicked the drop-down, he needs to click OK button twice to close the window. After a little research I found out the once the focus is moved out the drop-down...
0
1549
by: Diffident | last post by:
Hello All, I have an asp:button and I have tied an eventhandler to this button's click event which means that the eventhandler should be executed everytime I click the button. But to my frustration, the eventhandler does not get executed everytime I click the button. I have to click the button twice at times to make sure that the event handler is being called. Why is the control behaving in this way? This problem is not specific for a...
3
2505
by: JebBushell | last post by:
I'm a novice building a datagrid crud page and I have ASP.NET Cookbook and 4 web references to assist me. I am using VS 2003 so the code is not "inline". My problem is that when I click the Edit button on the grid nothing happens. Then I click it again and the expected happens i.e. the affected row is re-presented in text boxes. Both clicks of the Edit button cause a Page_Load but only the first fires the Edit event (where...
5
2653
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, Recently, I just found out that our program behaves differently from before. in our asp, in order to prevent data disppearing problem in form fields,we use session variable to display the field values if a customer click "back" button on the page2.asp in the browser,(the session variables Session(aQuoteName(iPerson)&"TripCost") is set up in the page2.asp) i.e. then in the page1.asp, we use: <input name="<%=aQuoteName(iPerson)&...
4
2641
by: leafboy75 | last post by:
Bit of a strange one. A Label will not update to show how manay records have been found, unless I click the button twice. Anyone know why Code below Private Sub storesrch_Click() Dim DateSrchCount DateSrchCount = DCount("", "qrySearchStoreNoResults") Me!frmSearchStoreNoResults.Visible = False DoCmd.RunCommand acCmdRefreshPage Me!livestoresrch.SetFocus
0
1845
by: imwhiteandnerdy | last post by:
i'm kinda a newbie I would appreciate some help Basically i'm setting up a search page using multiple options from a combo box Combo Box(2 options) First Name Last Name text box to the right of combo box with value to search eg COMBO BOX (First Name) TEXT BOX (eg bob) eg COMBO BOX (Last Name) TEXT BOX (eg smith)
3
1614
by: pawanez4u | last post by:
Hi I am using XAMPP software for PHP programming. As we know that the MS Sql Database which comes with XAMPP is totally GUI based we can create a table and enter the values directly, and also we can give constraints to the table fields. My requirement is when i click a button which is in PHP file. OnClick that has to take me to MS-Sql(phpmyadmin) table to enter the values.. Please help me and try to solve this problem.. Thanking...
1
1541
by: dougmeece | last post by:
Good Morning everyone. I have a form with two combo boxes and 1 command button. I am trying to use the command button to search a table and populate a query. I will then have the query display the results in the form (as a subform I presume). I have all the fields I need in the query and I included a WHERE clause that states: WHERE (((!!)=!)) I basically want to populate either (mot both) the By Title (cboByTitle) or the By Publisher...
3
5512
by: newlearner | last post by:
Hi All I have an interview question What will happen if i click the submit button twice in a JSP. Will the second request be processed or not. Thanks new learner
1
2811
by: Bhushan Deo | last post by:
string FilePath = GlobalVariables.appdrive.Trim() + "\\" + GlobalVariables.trfilepath.Trim() + "\\"; FilePath = FilePath + ExSegment.SelectedExchValue.Trim() + "\\" + GlobalVariables.TradeFile.Trim() + "\\"; FilePath = FilePath + TrdFileUpd.FileName.Trim();
0
8251
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8182
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8688
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8352
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8494
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6115
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1800
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1496
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.