473,326 Members | 2,173 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,326 software developers and data experts.

Can't execute javascript function in PHP

Hello everybody,
Please help me. I have a parent window, where is user input database into mySQL database, there is a select box to choose data from other table, if data is not exists. User press a button to open child window to input new data. I use php code and javascript:
Java script In parent window
Expand|Select|Wrap|Line Numbers
  1.     <script type="text/javascript">
  2. function MM_openBrWindow(theURL) { 
  3.   mywindow=window.open('input_typemachine_sub1.php?series=' + document.getElementById('series').value + '&seriesmachine=' + document.getElementById('series_machine').value,'','width=430,height=430');
  4.   mywindow.focus()
  5.  
  6. }
  7.  
PHP in parent window
Expand|Select|Wrap|Line Numbers
  1.                             <select name="typecode" id="typecode" >
  2.                                 <option value=""></option>
  3.                                 <?php
  4.                                     $sql="SELECT typecode, concat(typecode,' - ',Describe_VN) as typedes
  5.                                           FROM typemachine";
  6.                                     $result=mysqli_query($conn,$sql) or die(mysqli_error($conn));
  7.                                     while($row=mysqli_fetch_assoc($result)){
  8.                                     echo "<option value='$row[typecode]'";
  9.                                     $temp=isset($_POST['typecode']) ? $_POST['typecode'] : false;
  10.                                     if($temp == $row['typecode']) { echo "selected='selected'";}
  11.  
  12.                                     echo ">$row[typedes]</option>";
  13.                                     }
  14.                                     ?>
  15.                              </select>
  16.                              <input name="newtype" type="button" id="newtype" onClick="MM_openBrWindow()" value="New Type"/>
  17.  
  18.  
javascript in child window:
Expand|Select|Wrap|Line Numbers
  1. function typecodeclose(){
  2. opener.document.getElementById('series2').value=document.getElementById('series').value;
  3. self.close();
  4. }
  5.  
In submit button (Save button) of child window, I connect and save new data into database, and I want execute above function by echo command in section php code. But the function of javascript can't execute. I try javascript, it is ok if I use Onclick event in submit button.
Can you help me?
Jun 13 '12 #1
1 1985
Problem is solved! I change all from javascript to php. Mean is I didn't use window.open of javascipt for button, I used hyperlink in php and every thing is ok *but don't so good... :). I like window.open because seem it is more professional... :). Any idea?
Jun 15 '12 #2

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

Similar topics

2
by: John | last post by:
Hi, I am getting syntax errors in my JavaScript code, code snippet as follows (between my <script></script> tags: document.write(<a title="Nice to meet you" href="http://www.mydomain.com/"...
4
by: Steven | last post by:
Hello, I have 3 files -- 1. mainform.aspx 2. mainform.aspx.cs 3. mouse.js mainform.aspx contains a image button ("zoominimgbut") which will exceute C# code, whenever the user clicks on it....
2
by: Jim Hammond | last post by:
The script function in the code below works fine when it is JavaScript, but when I try to use C#, the function doesn't get executed. <body MS_POSITIONING="GridLayout"> <form id="Form1"...
2
by: jm | last post by:
I have a parent window: <script language="javascript"> function doSearch() { result=showModalDialog("searchmni.aspx?lastname=smith"); alert(result); } </script>
1
by: Markusek Peter | last post by:
How can I call JavaScript function within <TABLE> tags. I've got <table width="here should be return value from js script"> Thank you.
11
by: Hakan ÖRNEK | last post by:
Hi , I register client scripts like this; -------------------------------------------------------------------------- ----------- Public Sub CreateClientAlert(ByVal Message As String, ByVal...
0
by: ajitgoel | last post by:
Hi; We have a Javascript function which I have been tasked to move to a CSharp class. This javascript function uses Regular expression extensively. This function has a string input parameter and...
6
by: Ajit Goel | last post by:
Hi; We have a Javascript function which I have been tasked to move to a CSharp class. This javascript function uses Regular expression extensively. This function has a string input parameter and...
10
by: evicailieva | last post by:
A have a php scrip where I call a JavaScript function. I don't know why, but it doesn't work. At the beginning, when I was writing the script it was working but now it's not. I don't know wхat to do....
2
by: juliek | last post by:
I hope someone can help me. When a user selects a new item from a drop down list on an ASP.NET form, I'd like a javascript function to execute. How can I do this? I'm running the following...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.