I made a simple table math calculator.
Only now I want when you echo the number the ODD numbers are red and the even numbers display green.
Is this possible with css ? or do I have to rebuild the whole code ?
Code HTML + PHP
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<center>
<form action = "pagina2.php" method = "post">
<input name = "invoer" type = "text" value = "">
<input name = "knop" type = "submit" value = "Verstuur">
</form>
</center>
</body>
</html>
//PHP
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<center>
<?php
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
if (isset($_POST['invoer']))
{
if (is_numeric($_POST['invoer']))
{
for ($i = 1; $i <= 10; $i++)
{
echo $i . " x " . $_POST['invoer'] . " = " . ($i * $_POST['invoer']) . "<br />";
}
}
else
{
echo "Vul een getal in!";
}
}
else
{
echo "Niks ingevoerd!";
}
}
?>
</center>
<br>
<center>
<input action="action" type="button" value="Opnieuw" onclick="history.go(-1);" />
</center>
</body>
</html>
Greetings.
Change this echo statment
echo $i . " x " . $_POST['invoer'] . " = " . ($i * $_POST['invoer']) . "<br />";
To
$x=$i . " x " . $_POST['invoer'] . " = " . ($i * $_POST['invoer']) . "<br />";
if($x % 2 ==0 )
{
echo '<font color="green">'.$x.'</font>';
}
else echo '<font color="red">'.$x.'</font>';
I would use modulas to shorten your code
$number % 2 == 0 #means even
Then use a css class like .odd or .even and inject that into your template
I assume you are referring to the variable $i:
echo '<div style="color: '.($i%2==0 ? 'green' : 'red').">". $i . " x " . $_POST['invoer'] . " = " . ($i * $_POST['invoer']) . "</div><br />";
Related
I wanted to create a multiplication table with a custom function and also get the number of rows and columns from the user, and I want if each row was an even number then its field would be red (background) and if it was odd number it would have a green background and i also write some codes but i'm not sure if it's true or not:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<form method="post">
<input type="number" name="rows" placeholder="Rows">
<input type="number" name="columns" placeholder="Columns">
<button type="submit" name="button">
Create
</button>
</form>
<table border="1px">
<?php
if (isset($_POST["button"])) {
$userRows = $_POST["rows"];
$userColumns = $_POST["columns"];
function multiplicationTable($rows, $columns)
{
$zarb = $rows * $columns;
return $zarb;
}
$x = 1;
while ($x <= $userRows) {
echo "<tr>";
$y = 1;
while ($y <= $userColumns) {
if ($x % 2 == 0) {
echo "<td style='background-color: red;'>" . multiplicationTable($x, $y) . "</td>";
} else {
echo "<td style='background-color: green;'>" . multiplicationTable($x, $y) . "</td>";
}
$y++;
}
$x++;
echo "</tr>";
}
}
?>
</table>
</body>
</html>
How about changing the while loops to this:
while ($x <= $userRows) {
echo "<tr>";
$y = 1;
while ($y <= $userColumns) {
$val = multiplicationTable($x, $y);
if ($val % 2 == 0) {
echo "<td style='background-color: red;'>" . $val . "</td>";
} else {
echo "<td style='background-color: green;'>" . $val . "</td>";
}
$y++;
}
$x++;
echo "</tr>";
}
Well, your code looks good. Click here to see how it looks like...
the final result is in this link, and even if some of the numbers are even, they're still displayed in green and i don't know what should i do
https://imgur.com/D1Sweee
What i currently have
what im trying to make
I need it when i throw for example 2 and 3 it goes down 2 and marks it from left to right using black borders, and then it goes 3 to the right and mark from top to bottem using black borders, at the point they cross i need it to be a red border.
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="form.css">
</head>
<body>
<div class="wrapper">
<?php
if(isset($_POST['submit'])) {
$dice1 = mt_rand(1,6);
$dice2 = mt_rand(1,6);
echo "<table class='table'>";
for ($i=0; $i < 6 ; $i++) {
echo "<tr>";
for ($j=0; $j < 6 ; $j++) {
echo "<td> <img class='icon cell color".mt_rand(1,4)."' src='img/icon".mt_rand(1,4).".svg ' </td>";
}
echo "</tr>";
}
echo "</table>";
echo "<img class='dice1' src='img/dice".$dice1.".gif'>";
echo "<img class='dice2' src='img/dice".$dice2.".gif'>";
}
?>
<form method="get" action="/php1/eindopdracht/cal.php">
<button type="submit" class="button1">renew</button>
</form>
<form method="POST">
<button type='submit' class='button2' name='submit' value='submit'>throw</button>
</form>
</div>
</body>
</html>```
You can check if dice1 value is equal to $i you can add a certain class that makes the color black. Same if dice2 value is equal to $i. If then dice1 is equal to $i and dice2 value is equal to $j choose a different class to make the border red.
function chooseBorder($i,$j,$dice1,$dice2) {
$class = "";
if ($dice1 == $i && $dice2 == $j) {
$class = "border-red";
return $class;
}
if ($dice1 == $i || $dice2 == $j) {
$class = "border-black";
return $class;
}
return $class;
}
for ($i=0; $i < 6 ; $i++) {
echo "<tr>";
for ($j=0; $j < 6 ; $j++) {
$class = chooseBorder($i,$j,$dice1,$dice2);
echo "<td> <img class='icon cell color".mt_rand(1,4). " " . $class . "' src='img/icon".mt_rand(1,4).".svg ' </td>";
}
echo "</tr>";
}
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="form.css">
</head>
<body>
<div class="wrapper">
<?php
if(isset($_POST['submit'])) {
$dice1 = mt_rand(1,6);
$dice2 = mt_rand(1,6);
function chooseBorder($i,$j,$dice1,$dice2) {
$class = "";
if ($dice1 == $i && $dice2 == $j) {
$class = "border-red";
return $class;
}
if ($dice1 == $i || $dice2 == $j) {
$class = "border-black";
return $class;
}
return $class;
}
for ($i=1; $i < 7; $i++) {
echo "<tr>";
for ($j=1; $j < 7 ; $j++) {
$class = chooseBorder($i,$j,$dice1,$dice2);
echo "<td> <img class='icon cell color".mt_rand(1,4). " " . $class . "' src='img/icon".mt_rand(1,4).".svg ' </td>";
}
echo "</tr>";
}
echo "</table>";
echo "<img class='dice1' src='img/dice".$dice1.".gif'>";
echo "<img class='dice2' src='img/dice".$dice2.".gif'>";
}
?>
<form method="get" action="/php1/eindopdracht/cal.php">
<button type="submit" class="button1">renew</button>
</form>
<form method="POST">
<button type='submit' class='button2' name='submit' value='submit'>throw</button>
</form>
</div>
</body>
</html>
This Question is a bit long and I have edited too much to reduce my code but I hope anyone can help me out please!
I'm working on a Math test in times table project with php which will ask the user to enter his name and then ask him 10 questions like "2 x 2 = ?" giving four buttons to choose an answer and then after answering 10 questions the user will be redirected to result.php page which will show the result and here is what I wrote so far in homePage.php:
<?php
session_start();
if (isset($_POST['submit']) ) {
$_SESSION['QuestionNumber'] = 1;
$_SESSION['CorrectAnswers'] = 0;
$_SESSION['QuestionsAsnwered'] = 0;
$_SESSION['QuestionsAnswered'] = 0;
header("location: MathTest.php");
}
?>
<!DOCTYPE html>
<html>
<body>
<h1 align="center">Math Test</h1>
<form method="POST" action="">
<div style="text-align: center;">
<input type="submit" name="submit" value="Begin Test"">
</div>
</form>
</body>
</html>
and in MathTest.php which contains the problem:
<?php
session_start();
//just controlling user answer no problem here
if (isset($_POST[$_SESSION['UserAnswer']])) {
if ($_SESSION['QuestionNumber'] == 10) {
header("location: result.php");
}
if ($_SESSION['UserAnswer'] == $_SESSION['CorrectAnswer']) {
$_SESSION['QuestionNumber'] += 1;
$_SESSION['CorrectAnswers'] += 1;
$_SESSION['QuestionsAnswered'] += 1;
QuestionGenerator();
} else {
$_SESSION['QuestionNumber'] += 1;
$_SESSION['QuestionsAnswered'] += 1;
QuestionGenerator();
}
}
//I think that my problem(written down) is here
function QuestionGenerator(){
$rnd1 = rand(1, 12);
$rnd2 = rand(2, 12);
$CorrectAnswer = $rnd1 * $rnd2;
$WrongAnswer1 = $CorrectAnswer - 2;
$WrongAnswer2 = $CorrectAnswer + 2;
$WrongAnswer3 = $CorrectAnswer + 4;
$_SESSION['rnd1'] = $rnd1;
$_SESSION['rnd2'] = $rnd2;
$_SESSION['CorrectAnswer'] = $CorrectAnswer;
$_SESSION['WrongAnswer1'] = $WrongAnswer1;
$_SESSION['WrongAnswer2'] = $WrongAnswer2;
$_SESSION['WrongAnswer3'] = $WrongAnswer3;
$_SESSION['AnswersArray'] = array($_SESSION['CorrectAnswer'], $_SESSION['WrongAnswer1'], $_SESSION['WrongAnswer2'], $_SESSION['WrongAnswer3']);
}
function EchoAnswers($array) {
shuffle($array);
echo "<form method='POST' action='' ";
foreach ($array as $_SESSION['UserAnswer']) {
echo "<button><input style='width: 200px; height: 100px; font-size: 75px;' type='submit' name='" . $_SESSION['UserAnswer'] . "' value='" . $_SESSION['UserAnswer'] . "' ></button";
}
echo "</form>";
}
?>
<!DOCTYPE html>
<html>
<body>
<?php echo "<h1 align='center' style='font-size: 75px;'>Question " . $_SESSION['QuestionNumber'] . " of 10</h1>"; ?>
<h2 align="center" style="font-size: 60px"><?php echo $_SESSION['rnd1'] . " X " . $_SESSION['rnd2'] . " = ?" ?></h2>
<div align="center">
<?php EchoAnswers($_SESSION['AnswersArray']) ?>
</div>
</body>
</html>
the problem is when I click on any button it will only shuffle the answers but if I press the last button it will work full functionally
The problem I had was that there is 4 submit buttons each with different name tag so the session will only store the last input button and will make it functional but for the others it will only refresh the page with no different because they are not being controlled by php code so to solve this problem I only changed the EchoAnswers function like this:
function EchoAnswers($array) {
shuffle($array);
echo "<form method='POST' action='' ";
foreach ($array as $_SESSION['UserAnswer']) {
echo "<button><input style='margin: 10px; border: 3px solid black; background-color: lightblue; width: 200px; height: 100px; font-size: 75px;' type='submit' name='UserAnswer' value='" . $_SESSION['UserAnswer'] . "' ></button";
}
echo "</form>";
}
the name tag was also set to $_SESSION['UserAnswer'] so I changed this part to a normal name and I also changed the php code like this:
if (isset($_POST['UserAnswer'])) {
if ($_SESSION['QuestionNumber'] == 10) {
header("location: result.php");
}
if ($_SESSION['UserAnswer'] == $_SESSION['CorrectAnswer']) {
$_SESSION['QuestionNumber'] += 1;
$_SESSION['CorrectAnswers'] += 1;
$_SESSION['QuestionsAnswered'] += 1;
QuestionGenerator();
} else {
$_SESSION['QuestionNumber'] += 1;
$_SESSION['QuestionsAnswered'] += 1;
QuestionGenerator();
}
}
the part that I have changed in php code is isset($_POST['UserAnswer']) because UserAnswer was set to $_SESSION['UserAnswer'] instead of normal name in the name tag.
EDIT: Having issues with extra " or some sort of syntax when adding second select clause.
So im working on a php project using the mysql adventureworks sample database. Currently this page takes in an employees title which you can select from using the drop down box filled with all the possible titles to filter through the employees. However i wanted to add a second box with gender so someone could filter through a title and gender and get all the possible employees.
I have a tried a few things but they usually end up crashing the page.
Heres the first file: search.php
<?php
// Connect to the database
if (!include('connect.php')) {
die('error finding connect file');
}
$dbh = ConnectDB();
?>
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Cuprum'
rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/css?family=Amaranth"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono"
rel="stylesheet">
<link href="main.css" rel="stylesheet">
<title>Table Results</title>
</head>
<body>
<div class="content">
<h1>Search Adventureworks Employees</h1>
<p>Select two parameters and search information from the
AdventureWorks Database.</p>
<div class="form">
<form action="listTable.php" method="get">
<?php
// Get the full list of titles from Employee Table
$sql = "SELECT Distinct title FROM adventureworks.employee";
$stmt = $dbh->prepare($sql);
$stmt->execute();
// Prep drop down control
echo "<label for='title'>Select title: </label>\n";
echo "<select id='title' name='title'>\n";
// Put titles in the options
foreach ($stmt->fetchAll() as $titles) {
echo "<option value='" . $titles['title'] . "'>" .
$titles['title'] . "</option>\n";
}
// End dropdown
echo "</select>";
// Get the full list of genders from employee table
$sql3 = "Select Distinct gender FROM adventureworks.employee";
$stmt = $dbh->prepare($sql3);
$stmt->execute();
//Prep dropdown
echo "<label for ='gender'>Select Gender: </label>\n";
echo "<select id='gender' name = 'gender'>\n";
// Put genders in the options
foreach($stmt->fetchAll() as $genders) {
echo "<option value ='" . $genders['gender'] . "'> .
$genders['gender'] . "</option>\n";
}
//end dropdown and submit
echo "</select> <input type='submit'
value='Submit'>\n</form>\n</div>";
?>
</div>
</body>
</html>
And heres the second php file: listTable.php
<?php
// Connect to the database
if (!include('connect.php')) {
die('error finding connect file');
}
$dbh = ConnectDB();
?>
<html>
<head><link href='http://fonts.googleapis.com/css?family=Cuprum'
rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/css?family=Amaranth"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono"
rel="stylesheet">
<link href="main.css" rel="stylesheet">
<title>Table Results</title>
</head>
<body>
<div class='content'>
<?php
// Get table name from querystring
if (!isset($_GET["title"])) {
echo "No Title Selected";
}
else {
$title=$_GET["title"];
echo "<h1>Listing of Employees</h1>\n";
$sql1 = "SELECT column_name FROM information_schema.columns ";
$sql1 .= "WHERE table_name = 'employee'";
$stmt = $dbh->prepare($sql1);
$stmt->execute();
$cols = $stmt->rowCount();
// Prep table
$tableHTML = "<table>\n<thead>\n<tr>\n";
// Table headings (column names)
foreach ($stmt->fetchAll() as $columns) {
$tableHTML .= "<th>" . $columns['column_name'] . "</th>\n";
}
// Prep table body
$tableHTML .= "</tr>\n</thead>\n<tbody>\n";
// Table body (column values)
$sql2 = "SELECT * FROM adventureworks.employee e";
$sql2 .= " Where title like '$title'";
$stmt = $dbh->prepare($sql2);
$stmt->execute();
echo $stmt->rowCount() . " rows retrieved<br/><br />\n";
foreach ($stmt->fetchAll() as $rows ) {
$tableHTML .= "<tr>\n";
for ($i = 0; $i < $cols; $i++) {
$tableHTML .= "<td>" . $rows[$i] . "</td>\n";
}
$tableHTML .= "</tr>\n";
}
// End table
$tableHTML .= "</tbody>\n</table>\n";
echo $tableHTML;
echo "<div class='code'><br />" . $sql1 . "<p>" . $sql2 . "</div>\n";
}
?>
</div>
</body>
</html>
I understand what I would have to change in the second file in order to get the results I want but im having trouble just populating the second drop down in the first file.
Any help would be appreciated. Thanks.
You have missed a double quote in search.php
// Put genders in the options
foreach($stmt->fetchAll() as $genders) {
echo "<option value ='" . $genders['gender'] . "'>" .
$genders['gender'] . "</option>\n";
}
I have installed a jquery UI tabs system on my web page , but the I have had a series of problems , one of them being: I can make a form request to my PhP at the same page and then process the result on it self.
In other words: I want to set the action of the form in question to the the same tab, loaded from another file via ajax, that contains the form in the first place, so it can read and display a table with the search results.
Here are some codes, hope it helps.
The index (continas the #tabs div):
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="iso-8859-1" />
<link type="text/css" href="css/smoothness/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />
<link rel="stylesheet" type="text/css" href="css.css"></link>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<script type="text/javascript" src="maskMoney.js"></script>
<title>Financeiro</title>
</head>
<body>
<script>
$(function() {
$( "#tabs" ).tabs({
ajaxOptions: {
error: function( xhr, status, index, anchor ) {
$( anchor.hash ).html(
"A tab não pode ser carregada ou está sob manutenção, desculpe o transtorno." );
}
}
});
});
</script>
<div>
<div id="tabs">
<ul>
<li>Buscar saída</li>
<li>Criar saída</li>
</ul>
</div>
</div>
<script type="text/javascript" src="create.js"></script>
</body>
</html>
And here it is one of the forms I place under a tab (the financeiro_ver.php file):
<?php
include 'all.php';
if (isset($_POST['efetuar'])) {
$saida = new Saida();
if (isset($_POST['situacao'])) {
$saida->situacao = $_POST['situacao'];
} else {
$saida->situacao = 'npago';
}
$sql = "UPDATE financeiro SET situacao = '".$saida->situacao."' WHERE id = '".$_POST['saidaId']."'";
mysql_query($sql);
}
if (!isset($_SESSION)) {
session_start();
}
$_SESSION['ID_FUNCIONARIO'] = 46;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="iso-8859-1" />
<link type="text/css" href="css/smoothness/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />
<link rel="stylesheet" type="text/css" href="css.css"></link>
<title>Financeiro</title>
</head>
<body>
<form id="form0" name="form0" method="post" action="financeiro_ver.php"> <!--action="http://sim.medgoldman.com.br/financeiro/financeiro_ver.php" style="background-color:#EEEEEE"> -->
<table border="0" align="center" cellpadding="10" cellspacing="0">
<tr>
<td align="center">GRUPO:
<select name="categoria" id="produto">
<option value="adm">Despesas Administrativas</option>
<option value="imp">Importações</option>
<option value="ban">Bancos</option>
<option value="matriz">Despesas Matriz</option>
<option value="outros">Outros</option>
</select></td>
<td align="center">PERÍODO:
<td>de: <input name="data1" id="data1" value=""></input></td>
<td>até: <input name="data2" id="data2" value=""></input></td>
</select></td>
<td align="center"><input name="buscar" type="submit" id="buscar" value=" Buscar " /></td>
</tr>
</table>
</form>
<?php
if ($_SESSION['ID_FUNCIONARIO'] == '19') {
echo '<form name="form2" method="post" <!--action="http://sim.medgoldman.com.br/financeiro/financeiro_ver.php" --> style="background-color:#EEEEEE">';
}
?>
<table class ="viewTable" align="center">
<?php
if (isset($session->message)) {
$mens ="<th>" . $session->message . "</th>";
echo utf8_encode($mens);
}
if (isset($_POST['buscar'])) {
$query = "SELECT * FROM financeiro " .
"WHERE categoria = '" . $_POST['categoria'] .
"' AND data >= '" . $_POST['data1'] .
"' AND data <= '" . $_POST['data2'] . "'";
if (mysql_query($query, $database->connection)) {
$categoriaSel = mysql_query($query, $database->connection);
$output = '<tr><th colspan="3">Categoria ';
if ($_POST['categoria'] === 'adm') {
$output .= "Despesas administrativas";
} elseif ($_POST['categoria'] === 'imp') {
$output .= "Importações";
} elseif ($_POST['categoria'] === 'ban') {
$output .= "Bancos";
} elseif ($_POST['categoria'] === 'outros') {
$output .= "Outros";
} elseif ($_POST['categoria'] === 'matriz') {
$output .= "Despesas Matriz";
}
$output .= "</th>";
$output .= "<tr><th>Data</th><th>Descrição</th><th>Valor</th></tr>";
$valorSomaUS = 0;
$valorSomaRS = 0;
while ($saidasSel = mysql_fetch_array($categoriaSel)) {
$valorDisplay = number_format($saidasSel['valor'], '2', ',', '.');
$output .= "<tr";
if ($saidasSel['situacao'] === 'pago') {
$output .= ' class="pago"';
} else if ($saidasSel['situacao'] === 'npago') {
$output .= ' class="npago"';
}
$output .= ">";
$output .= "<td class=\"datout\">" . $saidasSel['data'] . "</td>";
$output .= "<td class=\"desout\">" . $saidasSel['descricao'] . "</td>";
if ($saidasSel['cambio'] === "us") {
$output .= "<td class=\"valout\"> U$ " . $valorDisplay . "</td>";
$valorSomaUS += $saidasSel['valor'];
} else {
$output .= "<td class=\"valout\"> R$ " . $valorDisplay . "</td>";
$valorSomaRS += $saidasSel['valor'];
}
//VERIFICA USUARIO PARA ADICIONAR PAGO/NPAGO:
if ($_SESSION['ID_FUNCIONARIO'] == '19') {
$output .= '<td><input name="situacao" type="checkbox" value="pago"';
if ($saidasSel['situacao'] === 'pago') {
$output .= ' checked';
}
$output .=">Pago</input></td>";
}
//VERIFICA USUARIO PARA VER PAGO/NPAGO:
if ($_SESSION['ID_FUNCIONARIO'] == '46') {
if ($saidasSel['situacao'] === 'pago') {
$output .= '<td>pago</td>';
} else {
$output .= '<td>não pago</td>';
}
}
if ($_SESSION['ID_FUNCIONARIO'] == '30' && $saidasSel['categoria'] === "imp") {
if ($saidasSel['situacao'] === 'pago') {
$output .= '<td>pago</td>';
} else {
$output .= '<td>não pago</td>';
}
}
//VERIFICA USUARIO PARA ADICIONAR DELETAR:
if (($_SESSION['ID_FUNCIONARIO'] == '46') && ($saidasSel['categoria'] === 'adm' || $saidasSel['categoria'] === 'outros' || $saidasSel['categoria'] === 'matriz')) {
$output .= "<td><button class=\"deletar\" href=\"financeiro_deletar.php?id=" . $saidasSel['id'] . "\">Deletar</button>";
} elseif (( $_SESSION['ID_FUNCIONARIO'] == '30' || $_SESSION['ID_FUNCIONARIO'] == '46' ) && $saidasSel['categoria'] === 'imp') {
$output .= "<td><button class=\"deletar\" href=\"financeiro_deletar.php?id=" . $saidasSel['id'] . "\">Deletar</button></td>";
}
$output .="</tr>";
//SOMA DOS VALORES DO PERIODO:
$valorSomaUS = number_format($valorSomaUS, '2', ',', '.');
$valorSomaRS = number_format($valorSomaRS, '2', ',', '.');
$output .= "<tr> <td class=\"valsoma\" colspan=\"3\"> Soma do período = R$ " . $valorSomaRS . " e U$ " . $valorSomaUS . "</td></tr>";
if ($_SESSION['ID_FUNCIONARIO'] == '19') {
$output .= '<tr><td><input id="efetuar" type="submit" value=" Efetuar " name="efetuar"></input></td><td><input type="hidden" value="' . $saidasSel['id'] . '" name="saidaId"></input></td></tr>';
}
}
echo utf8_encode($output);
} else {
$session->message("Nenhuma saída para este período.");
}
}
?>
</table>
<?php
if ($_SESSION['ID_FUNCIONARIO'] == '19') {
echo '</form>';
}
?>
</body>
</html>
http://jsfiddle.net/mZLDk/
$(document).ready(function() {
// Tab initialization
// This is setup for two tab groups and is not needed
$('#tabs, #fragment-1').tabs({
select: function(event, ui){
var tabNumber = ui.index;
var tabName = $(ui.tab).text();
//Here I setup an event for each change this changes some inner html
//of a tag but can be applied in your situation
if(tabNumber = 1 ) {
document.getElementById('fragment-1a').innerHTML = "changed";
} else {
}
//This was just some debuging code for me
console.log('Tab number ' + tabNumber + ' - ' + tabName + ' - clicked');
}
});
});
You would replace the line
document.getElementById('fragment-1a').innerHTML = "changed";
with
document.forms[0].action = "An Action";
Im really excited as this is my first working answer for some one on this site so please tell me if it works
THE BIG LONG STORY OF HOW A COMPLETE JAVASCRIPT NOOB FOUND YOUR ANSWER
As an idea you could try making it so the tabs event changes the setting IE this
jQuery - trapping tab select event
but how does that apply to you well I found something else here
http://www.tek-tips.com/viewthread.cfm?qid=1235640
this talks about chagines a form action based uppon an event which you can change onlcick.
But now an example that brings the two together
http://jsfiddle.net/mZLDk/