I have inherited a php script that nests php, javascript, and html.
How do I clean up code like this:
I think I can move the javascript into a seperate .js file at the
least. What about the nesting of php inside the html?
<?php
....snip...
function ShowCart()
{
...
?>
<html>
...
<script language="JavaS cript">
function UpdateQty(item, backPage)
{
...
}
</script>
</head>
<body bgcolor="#fffff f">
...
<?php
while($row = @mysql_fetch_ar ray($result))
{
...
?>
<tr>
<td width="15%" height="25">
<font face="verdana" size="1" color="black">
<select name="<?php echo $row["itemId"]; ?>"
onChange="Updat eQty(this,'<?ph p echo $_GET['back']; ?>')">
....
}
How do I clean up code like this:
I think I can move the javascript into a seperate .js file at the
least. What about the nesting of php inside the html?
<?php
....snip...
function ShowCart()
{
...
?>
<html>
...
<script language="JavaS cript">
function UpdateQty(item, backPage)
{
...
}
</script>
</head>
<body bgcolor="#fffff f">
...
<?php
while($row = @mysql_fetch_ar ray($result))
{
...
?>
<tr>
<td width="15%" height="25">
<font face="verdana" size="1" color="black">
<select name="<?php echo $row["itemId"]; ?>"
onChange="Updat eQty(this,'<?ph p echo $_GET['back']; ?>')">
....
}
Comment