[PHP] Open new window for update
Hi.. it's been a long time to post here.
I'm a new coder in PHP and i have some problem on my first project.
i just want to have a popup window where i can update my database regarding on what record no that i click.
here's some of my poor code :) (sorry im a newbie).. hope you understand my problem guys..
thanks a lot...
PHP Code:
<script type="text/javascript" language="javascript">
function OpenWindow()
{
window.open ('UpdateASUSLack.php','','width=200,height=100')
}
</script>
<?php
$lackQuery=mysql_query("select * from tbl_asus_lacking WHERE status='Open'");
while ($Result=mysql_fetch_array($lackQuery))
{
echo "<tr>";
echo "<form action='ViewASUSLacking.php' method='post'>";
echo "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['UnitPN']."</td>";
echo "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['UnitDesc']."</td>";
echo "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['OldSN']."</td>";
echo "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['NewSN']."</td>";
echo "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['LackPN']."</td>";
echo "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['LackDesc']."</td>";
echo "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['Customer']."</td>";
echo "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['Location']."</td>";
echo "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['RMANo']."</td>";
echo "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['Station']."</td>";
echo "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['inputDate']."</td>";
echo "<td class='text1' align='center' bgcolor='$bgcolor'>"."<input type='submit' name='close' value='update' id='$Result[RecNo]' onclick='OpenWindow()'>"."</td>";
echo "</form>";
}
?>
Re: [PHP] Open new window for update
the problem is i dont know how can i display the record no from my opener window to new window.
and the new window will let me update the data based on record no will show up (which came from the window.opener) on new window. :)
please kinldy help me.
thanks in advanced.
1 Attachment(s)
Re: [PHP] Open new window for update
This could be help. :)
Attachment 101339
Re: [PHP] Open new window for update
i was thinking what i was gonna tell you since i was reading another post...hope this post will help you since i cannot access the internet in here (they say its for security reason) anyway, if you are trying to have another window popup you should use java-script for that..but you can redirect the user to another page by using header function for php or meta refresh for html. since you are using window.open , and regarding to your #3 post if its a page you can use onclick event to popup a simple window instead of a new page to edit any record , a little bit more information would be good for other ppl that would check this thread
Good Day
1 Attachment(s)
Re: [PHP] Open new window for update
hope somebody will understand this.. thanks..
Attachment 101363
Re: [PHP] Open new window for update
Why are you echoing html? That is bad practice! PHP and html should be kept separate. What are the ids of the text boxes on the window that pops up?
Re: [PHP] Open new window for update
sorry for my code.. maybe i will learn on how to separate HTML and PHP one of this days.
i will try to study it.
and here's my code for the pop up window:
PHP Code:
echo "<table class='original' cellspacing='1' border='0'>";
echo "<form action='ViewASUSLacking.php' method='post'>";
echo "<td class='text2' bgcolor='e3e6e5' height='40'>"."UNIT P/N:"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='UnitPN'>"."</td>";
echo "<tr>";
echo "<td class='text2' bgcolor='e3e6e5'>"."MODEL:"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='Model'>"."</td>";
echo "<tr>";
echo "<td class='text2' bgcolor='e3e6e5'>"."SERIAL #"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='oldSerial'>"."</td>";
echo "<tr>";
echo "<td class='text2' bgcolor='e3e6e5'>"."NEW SERIAL #"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='newSerial'>"."</td>";
echo "<tr>";
echo "<td class='text2' bgcolor='e3e6e5'>"."LACKING P/N"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='lackPN'>"."</td>";
echo "<tr>";
echo "<td class='text2' bgcolor='e3e6e5'>"."DESCRIPTION"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='lackDesc'>"."</td>";
echo "<tr>";
echo "<td class='text2' bgcolor='e3e6e5'>"."CUSTOMER"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='customer'>"."</td>";
echo "<tr>";
echo "<td class='text2' bgcolor='e3e6e5'>"."LOCATION"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='location'>"."</td>";
echo "<tr>";
echo "<td class='text2' bgcolor='e3e6e5'>"."RMA #"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='RMANo'>"."</td>";
echo "<tr>";
echo "<td class='text2' bgcolor='e3e6e5'>"."STATION"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='station'>"."</td>";
echo "<tr>";
echo "<tr>";
echo "<tr>";
echo "<tr>";
echo "<tr>";
echo "<tr>";
echo "<td class='text1' align='right'>"."<td class='text1' align='right'><input type='submit' value='Update' name='close'>"."</td>"."</td>";
echo "</form>";
Re: [PHP] Open new window for update
Re: [PHP] Open new window for update
i see this post in JAVASCRIPT forum.
may i kindly ask how can i apply this one in my PHP project?
Thanks.
http://www.vbforums.com/showthread.p...=2#post3256067
Re: [PHP] Open new window for update
Quote:
Originally Posted by
disinwebe
hope i'm not still late and u checking this post... its a long story how you can use the post method in javascript you have to defined which of the div in html sending the data for javascript since i still dont have access to any kind of compiler i try explain it to you
1- after you made ur html page you have to give it a specific id so you can use it for javascript remember to use <DIV>
2- after you check if the data is send you have to get the element by id
3- txtData2.value = window.opener.document.getElementById('YOUR ID').value;
4- you have to send the data to database
like i said its a lot of code i just explain it to you in a snap of a finger :D:D:D google post data in javascript and you will find helpful codes
GoodDuck:duck: