While loop form in PHP - php

I want to develop while loop form in PHP. I am able to create different name in each row but don't know how to handle POST value in next page.
Below is my code:
<form action="sms.php" method="post" enctype="multipart/form-data">
<table class="table table-hover" style="border: groove;">
<thead>
<tr>
<th>Student Id</th>
<th>Student Name</th>
<th>Phone Number</th>
<th>Today's Attendance</th>
</tr>
</thead>
<tbody>
<?php
$c = 1;?>
<?php
$database = new Database();
$db = $database->getConnection();
$user = new User($db);
$stmt = $user->present();
while($ro1 = $stmt->fetch(PDO::FETCH_ASSOC))
{
?>
<tr>
<td><input name ="uname" id ="uname" style ="border:none;background: none;" value = "<?php echo $ro1['user_id'] ?>" readonly/></td>
<td><?php echo $ro1['first_name'] ?> <?php echo $ro1['last_name'] ?></td>
<td><input name = "list<?php echo $c++ ?>" id ="cont1" type="number" style ="border:none;background: none;" onBlur="checkAvailability1a()" value="<?php echo $ro1['parent_contact'] ?>"/></td>
<td><input id="press1" name="press1" type="button" value="<?php echo $ro1[$_SESSION['dyy']] ?>" onclick="return change(this);" onBlur="checkAvailability()" class="w3-button w3-teal"/></td>
</tr>
<?php } ?>
</tbody>
</table>
<button name="back"><a href = 'attendance.php'>< Back</a></button>
<button type="submit" name="next">Next</a></button>

You don't need to give your input name a counter based on the loop. You can use array notation for your input name, for example:
<?php
$database = new Database();
$db = $database->getConnection();
$user = new User($db);
$stmt = $user->present();
while($ro1 = $stmt->fetch(PDO::FETCH_ASSOC)) {
?>
<tr>
<td><input name ="uname[]" id ="uname" style ="border:none;background: none;" value = "<?php echo $ro1['user_id'] ?>" readonly/></td>
<td><?php echo $ro1['first_name'] ?> <?php echo $ro1['last_name'] ?></td>
<td><input name = "list[]" id ="cont1" type="number" style ="border:none;background: none;" onBlur="checkAvailability1a()" value="<?php echo $ro1['parent_contact'] ?>"/></td>
<td><input id="press1" name="press1[]" type="button" value="<?php echo $ro1[$_SESSION['dyy']] ?>" onclick="return change(this);" onBlur="checkAvailability()" class="w3-button w3-teal"/></td>
</tr>
<?php } ?>
Then in your next page (sms.php) you can get the request parameter with $_POST['list'] (without the [] ). That parameter will be an array in php.

Related

updating values in a table by using a button

So I have a list of items and for each item, there is a remove and update button, the remove will remove the row from the database, and the update button will change the quantity.
But the problem is, I can only update or remove the last item in the list. and I have tried many things but with no solution.
Any suggestions?
The sql query and the form:
$totaloftotal=0;
try{
require('connection.php');
$sql="select i.item_name, c.qty, i.item_price, c.iid, i.item_photo, i.item_qty, c.cart_id FROM items i, cart c WHERE i.item_id=c.iid and uid=23 ";
$rs=$db->query($sql);
if($rs->rowCount()==0){
echo"CART EMPTY!!";
} else{
?>
<thead>
<tr>
<th>Update</th>
<th>Remove</th>
<th>Image</th>
<th>Product Name</th>
<th>Quantity</th>
<th>Unit Price</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr>
<?php
while($row = $rs->fetch()){
$total=0;
$total+=$row[2];
?>
<form method="post" action="updatecart.php">
<td><button class="btn" type="submit" name="update" >Update</button></td>
<td><button class="btn" type="submit" name="remove" >Remove</button></td>
<?php echo"$row[1]"?>
<input type="hidden" name="itemid" value=<?php echo"$row[3]"?>>
<input type="hidden" name="cartid" value=<?php echo"$row[6]"?>>
<td>
<a href="product_detail.html">
<img alt="" src="photos/<?php echo"$row[4]"?> " width= 100 height=100>
</a>
</td>
<td><?php echo"$row[0]"?></td>
<td>
<input type="number" id="quantity" name="quantity" min=1 max=<?php echo"$row[5]"?> value=<?php echo"$row[1]"?>></td> td>
<?php echo"$row[2]"?><</td>
<?php $total = $total * $row[1]?>
<td><?php echo"$total"?></td>
</tr>
<?php $totaloftotal+=$total;?>
<?php
}
//echo"$totaloftotal";
}
} catch ( PDOException $e ){
die($e->getMessage() );
}
?>
and here is the updatecart.php which is supposed to make the changes:
<?php
print_r($_POST);
extract($_POST);
if(isset($update)){
try{
require('connection.php');
$qty= $_POST["quantity"];
$itemid= $_POST["itemid"];
$cartid= $_POST["cartid"];
$qty= intval($qty);
$sql2= "update cart set qty=$qty where iid=$itemid and uid=23";
$x = $db->exec($sql2);
$db=null;
header("location:cart.php");
}catch (PDOException $e){
die( $e->getMessage() );
}
}
else{
try{
require('connection.php');
$sql2= "delete from cart where iid=$itemid";
$x = $db->exec($sql2);
$db=null;
header("location:cart.php");
}catch ( PDOException $e ){
die($e->getMessage());
}
}
?>
try use while : and endwhile
...
<tbody>
<tr>
<?php
while($row = $rs->fetch()):
?>
<?php
$total=0;
$total+=$row[2];
?>
<form method="post" action="updatecart.php">
<td> <button class="btn" type="submit" name="update" >Update</button></td>
<td> <button class="btn" type="submit" name="remove" >Remove</button></td>
<?php echo"$row[1]"?>
<input type="hidden" name="itemid" value="<?php echo $row[3]?>">
<input type="hidden" name="cartid" value="<?php echo $row[6]?>">
<td><img alt="" src="photos/<?php echo"$row[4]"?> " width= 100 height=100></td> <td><?php echo"$row[0]"?>
</td>
<td><input type="number" id="quantity" name="quantity" min=1 max=<?php echo"$row[5]"?> value=<?php echo"$row[1]"?>></td> td><?php echo"$row[2]"?><</td>
<?php $total = $total * $row[1]?> <td><?php echo"$total"?></td>
</tr>
<?php $totaloftotal+=$total;?>
<?php endwhile ?>
//echo"$totaloftotal";
.....

how to get another value with ajax from foreach table

I have table from foreach, in this table i create submit with ajax (id="detail"), but why when i submit i just get first row, when i click second row value, i get first row value not second row value ?
<form action="<?php echo base_url() ?>index.php/stock_opname/proses_detail" method="post">
<table class="table table-striped">
<thead>
<tr>
<th>No</th>
<th>SO No</th>
<th>Opname Date</th>
<th>Warehouse</th>
<th>Type</th>
<th>Approve</th>
<th>Close period</th>
<th>Detail</th>
</tr>
</thead>
<tbody>
<?php $no=1; foreach ($show as $key) { ?>
<tr>
<td><?php echo $no ?></td>
<td><input type="text" id="sono" value="<?php echo $key->sono ?>"></td>
<td><input type="text" id="opnamedate" value="<?php echo $key->opnamedate ?>"></td>
<td><input type="text" id="warehousecode" value="<?php echo $key->warehousecode ?>"></td>
<td><input type="text" id="stocktypeid" value="<?php echo $key->stocktypeid ?>"></td>
<td></td>
<td></td>
<td>Detail</td>
</tr>
<?php $no++;} ?>
</tbody>
</table>
</form>
<script type="text/javascript">
//Ajax Load data from ajax
$(document).on('click', '#detail', function(){
var sono = $('#sono').val();
var opnamedate = $('#opnamedate').val();
var wh = $('#warehousecode').val();
var stocktypeid = $('#stocktypeid').val();
alert(sono);
});
you have to make the id also dynamic and also the script sholud be dynamic.Hope you get it
id="detail1"
.on('click', '#detail1', function() ----for first
.on('click', '#detail2', function() ----for second and so on
<form action="<?php echo base_url() ?>index.php/stock_opname/proses_detail" method="post">
<table class="table table-striped">
<thead>
<tr>
<th>No</th>
<th>SO No</th>
<th>Opname Date</th>
<th>Warehouse</th>
<th>Type</th>
<th>Approve</th>
<th>Close period</th>
<th>Detail</th>
</tr>
</thead>
<tbody>
<?php $no=1; foreach ($show as $key) { ?>
<tr>
<td><?php echo $no ?></td>
<td><input type="text" id="sono<?php echo $no; ?>" value="<?php echo $key->sono ?>"></td>
<td><input type="text" id="opnamedate<?php echo $no; ?>" value="<?php echo $key->opnamedate ?>"></td>
<td><input type="text" id="warehousecode<?php echo $no; ?>" value="<?php echo $key->warehousecode ?>"></td>
<td><input type="text" id="stocktypeid<?php echo $no; ?>" value="<?php echo $key->stocktypeid ?>"></td>
<td></td>
<td></td>
<td>Detail</td>
</tr>
<?php $no++;} ?>
</tbody>
</table>
</form>
<script type="text/javascript"> //Ajax Load data from ajax
function getDetails(no){
var sono = $('#sono'+no).val();
var opnamedate = $('#opnamedate'+no).val();
var wh = $('#warehousecode'+no).val();
var stocktypeid = $('#stocktypeid'+no).val();
alert(sono);}
hope this will help
Can you try this ?
$('#detail').click(function(){
var sono = $(this).siblings('#sono').val();
var opnamedate = $(this).siblings('#opnamedate ').val();
var wh = $(this).siblings('#wh').val();
var stocktypeid = $(this).siblings('#stocktypeid ').val();
alert(sono);
});

PHP Fetches two rows but uploads file from last row only

Im trying to fetch records from database, then i have to upload a image which should be stored in folder and also link to be updated in table.. Everything working fine only with last row.. For first row its not updating.. Please help me where im goin on.. Below is my code
<?php
$email1 = $_SESSION['email'];
$Vendor_id = "SELECT Vendor_id FROM vendors where email = '$email1' ";
$result = mysqli_query($conn, $Vendor_id);
$row = mysqli_fetch_row($result);
$sql = "select Vendor_wallet_id, total_amount, request, amount, status, amt_pdflink from vendor_wallet";
$query = mysqli_query($conn, $sql);
?>
<form action="upload.php" method="post" enctype="multipart/form-data">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Transfer ID</th>
<th>Request</th>
<th>Amount</th>
<th>Status</th>
<th>Upload</th>
<th>Submit</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($query))
{
$cpid = $row['Vendor_wallet_id'];
$tid = $row['request'];
$type = $row['amount'];
$pays = $row['status'];
$amt = $row['amt_pdflink'];
?>
<tr>
<td value="<?php echo $cpid; ?>" name="cpid"><?php echo $cpid; ?></td>
<td><?php echo $tid; ?></td>
<td><?php echo $type; ?></td>
<td><?php echo $pays; ?></td>
<td><input type="file" value="<?php echo $amt; ?>" name="fileToUpload" id="fileToUpload" ></td>
<td><input type="submit" value="Submit" name="submit" >
</button>
</td> </tr>
<?php } ?>
</tbody>
</table>
</form>
upload.php is taken from https://www.w3schools.com/php/php_file_upload.asp
on your form
<?php
$email1 = $_SESSION['email'];
$Vendor_id = "SELECT Vendor_id FROM vendors where email = '$email1' ";
$result = mysqli_query($conn, $Vendor_id);
$row = mysqli_fetch_row($result);
$sql = "select Vendor_wallet_id, total_amount, request, amount, status, amt_pdflink from vendor_wallet";
$query = mysqli_query($conn, $sql);
?>
<form action="upload.php" method="post" enctype="multipart/form-data">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Transfer ID</th>
<th>Request</th>
<th>Amount</th>
<th>Status</th>
<th>Upload</th>
<th>Submit</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($query))
{
$cpid = $row['Vendor_wallet_id'];
$tid = $row['request'];
$type = $row['amount'];
$pays = $row['status'];
$amt = $row['amt_pdflink'];
?>
<tr>
<td value="<?php echo $cpid; ?>" name="cpid"><?php echo $cpid; ?></td>
<td><?php echo $tid; ?></td>
<td><?php echo $type; ?></td>
<td><?php echo $pays; ?></td>
<td><input type="file" name="fileToUpload []" class="fileToUpload" ></td>
<input type="hidden" value="<?php echo $amt; ?>" name="fileToUploadLink []" class="fileToUploadLink" >
<td><input type="submit" value="Submit" name="submit" >
</button>
</td> </tr>
<?php } ?>
</tbody>
</table>
</form>
on upload.php
<?php
if(isset($_FILES['fileToUpload']['tmp_name'])&&isset($_POST['fileToUploadLink'])){
for($i=0;$i<=(count($_FILES['fileToUpload']['tmp_name'])-1);$i++){
move_uploaded_file($_FILES['fileToUpload']['tmp_name'][$i],$_POST['fileToUploadLink'][$i]);
}
}
?>
I have a few suggestions:
In your "php.ini" file, search for the file_uploads directive, and set it to On: file_uploads = On
...</button><!-- <<-- How are you using this? -->
Could try to echo $amt; at the bottom of the loop to see if the path is correct.
May want to check if the $amt with IF Empty condition/statement and maybe check the condition of your other variables.
$email1 = $_SESSION['email'];
$Vendor_id="SELECT Vendor_id FROM vendors where email = '$email1' ";
$result=mysqli_query($conn,$Vendor_id);
$row = mysqli_fetch_row($result);
$sql = "select Vendor_wallet_id, total_amount, request, amount, status, amt_pdflink from vendor_wallet";
$query = mysqli_query($conn, $sql);
?>
<form action="upload.php" method="post" enctype="multipart/form-data">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Transfer ID</th>
<th>Request</th>
<th>Amount</th>
<th>Status</th>
<th>Upload</th>
<th>Submit</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($query))
{
$cpid=$row['Vendor_wallet_id'];
$tid=$row['request'];
$type=$row['amount'];
$pays=$row['status'];
$amt=$row['amt_pdflink'];
?>
<tr>
<td value="<?php echo $cpid; ?>" name="cpid"><?php echo $cpid;?></td>
<td><?php echo $tid;?></td>
<td><?php echo $type;?></td>
<td><?php echo $pays;?></td>
<td><input type="file" value="<?php echo $amt;?>" name="fileToUpload" id="fileToUpload" ></td>
<td><input type="submit" value="Submit" name="submit" >
</button> <!-- WHY IS THIS HERE? -->
</td></tr>
<?php
echo $amt; //See if it is correct path
}//END WHILE ?>
</tbody>
</table>
</form>
There are a few ways in which you could do the file upload, one of which would be to make the form a child of a single table cell and have the file field as a direct child of that form. The submit button, to keep the layout, would not be a child of the form and would need to be changed to a simple button input type then use javascript to submit the form
<?php
$email1 = $_SESSION['email'];
$Vendor_id = "SELECT Vendor_id FROM vendors where email = '$email1' ";
$result = mysqli_query($conn, $Vendor_id);
$row = mysqli_fetch_row($result);
$sql = "select Vendor_wallet_id, total_amount, request, amount, status, amt_pdflink from vendor_wallet";
$query = mysqli_query($conn, $sql);
?>
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Transfer ID</th>
<th>Request</th>
<th>Amount</th>
<th>Status</th>
<th>Upload</th>
<th>Submit</th>
</tr>
</thead>
<tbody>
<?php
while( $row = mysqli_fetch_array( $query ) ) {
$cpid = $row['Vendor_wallet_id'];
$tid = $row['request'];
$type = $row['amount'];
$pays = $row['status'];
$amt = $row['amt_pdflink'];
?>
<tr>
<td value="<?php echo $cpid; ?>" name="cpid"><?php echo $cpid; ?></td>
<td><?php echo $tid; ?></td>
<td><?php echo $type; ?></td>
<td><?php echo $pays; ?></td>
<td>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" value="<?php echo $amt; ?>" name="fileToUpload" />
</form>
</td>
<td><input type="button" value="Submit" name="submit" /></td>
</tr>
<?php
}
?>
</tbody>
</table>
<script>
var bttns=Array.prototype.slice.call(document.querySelectorAll('input[type="button"][name="submit"]'));
bttns.forEach(function(bttn){
bttn.addEventListener('click',function(evt){
this.parentNode.parentNode.querySelector('form').submit();
}.bind(bttn),false );
});
</script>
Seems like You want to make a form per row.
<tr>
<td value="<?php echo $cpid; ?>" name="cpid"><?php echo $cpid; ?></td>
<td><?php echo $tid; ?></td>
<td><?php echo $type; ?></td>
<td><?php echo $pays; ?></td>
<td colspan="2">
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="Vendor_wallet_id" value="<?php echo $cpid;?>" />
<input type="file" value="<?php echo $amt; ?>" name="fileToUpload" />
<button>Submit</button>
</form>
</td>
</tr>
</form>
and remove <form> tag that wraps table

Update sql data from form and checkboxes

I have created a form that update the data in a sql column, so far all good.
The problem I have is that I would like to choose what columns are going to be updated, with checkboxes.
So I want to categorize two files as movies, I just check the checkbox and write movies in the form.
But its not only that. Every column is already connected to a checkbox, but I use this checkbox with an delete query, so I can delete multiple rows.
So my question is more like, how can I combine this two function with "one" checkbox.
This is some of my code.
This is my table with the sql outputs, and with the delete button
<?php
$files = mysql_query("SELECT * FROM files WHERE `user_name` = '{$_SESSION['username']}' ORDER BY `file_time` DESC LIMIT $start, $per_page")
or die(mysql_error());
?>
<table id="table-3">
<thead>
<tr>
<th scope="col">Upload User</th>
<th scope="col">Filename</th>
<th scope="col">Upload date</th>
<th scope="col">IP adress</th>
<th scope="col">Category</th>
<th scope="col">Delete</th>
</tr>
</thead>
<?php
while (($row = mysql_fetch_assoc( $files )) !==false)
{
echo "<tr>";
echo "<td>".$row['user_name'] . "</td> ";
?>
<td class="download"> <?php echo $row['file_name']; ?></td>
<?php echo "<td>".$row['file_time'] . "</td> "; ?>
<?php echo "<td>".$row['file_ip'] . "</td> "; ?>
<?php echo "<td>".$row['category'] . "</td> "; ?>
<td>
<form action="delete.php" method="post">
<input type="checkbox" name="done[]" id="<?php echo $row['file_id'] ?>" value="<?php echo $row['file_id'] ?>">
</td>
<?php
}
echo "</tr>";
echo "</table>";
?>
<input type ="submit" value ="Delete">
</form>
This form is the one with the update function
<form action="function.php" method="post">
category: <input type="text" name="category" />
<input type="submit" />
</form>
and
function.php
include('core/inc/init.inc.php');
if(isset($_POST['category'])){
$category = $_POST['category'];
mysql_query("UPDATE files SET category='$category'
/*WHERE category='genom' */ ");
header("Location: profile.php?uid=" . $_SESSION['uid']);
}else{
header("Location: profile.php?uid=" . $_SESSION['uid']);
};
How can I combine these two functions?
You can have multiple submit buttons in the same form. So you can do something like this:
<?php
$files = mysql_query("SELECT * FROM files WHERE `user_name` = '{$_SESSION['username']}' ORDER BY `file_time` DESC LIMIT $start, $per_page")
or die(mysql_error());
?>
<form action="updateordelete.php" method="post">
<table id="table-3">
<thead>
<tr>
<th scope="col">Upload User</th>
<th scope="col">Filename</th>
<th scope="col">Upload date</th>
<th scope="col">IP adress</th>
<th scope="col">Category</th>
<th scope="col">Delete</th>
</tr>
</thead>
<?php
while (($row = mysql_fetch_assoc( $files )) !==false)
{
?>
<tr>
<td> <?php echo $row['user_name']; ?></td>
<td class="download"> <?php echo $row['file_name']; ?></td>
<td><input type="text" name="file_time[<?php echo $row ['file_id']; ?>]" value="<?php echo $row['file_time']; ?>" /></td>
<td><input type="text" name="file_ip[<?php echo $row ['file_id']; ?>]" value="<?php echo $row['file_ip']; ?>" /></td>
<td><input type="text" name="file_category[<?php echo $row ['file_id']; ?>]" value="<?php echo $row['category']; ?>" /></td>
<td><input type="checkbox" name="done[]" id="<?php echo $row['file_id'] ?>" value="<?php echo $row['file_id'] ?>"></td>
</tr>
<?php } ?>
</table>
<input type ="submit" name="submittype" value = "Update">
<input type ="submit" name="submittype" value = "Delete">
</form>
And then, in updateordelete.php:
if($_POST['submittype']=="Delete"){
(do delete code...)
}elseif($_POST['submittype']=="Update"){
(do update code...)
}
For each of the values, you can access them using $_POST['file_category']. For example:
$file_categories=$_POST['file_category'];
foreach($_POST['done'] as $file_id){
echo $file_categories[$file_id];
}

php $_get variable gone after submitting form

my problem goes like this:
my home page has tables with rows pulled from the database (while loops)
each row has a - cell in which he can add an event to that specific row
in order to do that i send the row id as a $_GET variable from the home page table
and in the "add event" page i store it as a variable
but when i submit my addevent form without filling it properly (as i coded) it simply refreshes the form only without the row id in the url therefor also the query i do in the beginning of the page for pulling the row data can no longer execute and that pops a PHP error
for the id variable which i sign it the $_GET and the query (mysql fetch array).
also of course all the data which i display in the form from that query is gone.
any suggestions on how to approach this ? thanks in advance, Regards.
EDIT:** kill the new guy! -Sorry i guess
home page where i send the id :
$sql = "SELECT * FROM alarms WHERE alarmstatus = 'OFF' and starttime='::' ORDER BY clientid ASC";
$query = mysql_query($sql);
echo "<table cellpadding='1px' border='1px' bordercolor='#0066FF' cellspacing='0'>
<form action='hpage.php' method='get'>";
while($fetch = mysql_fetch_array($query)) {
echo "<tr>
<td>
".$fetch['clientid']."</td>
<td>".$fetch['controller']."</td>
<td>".$fetch['typeid']."</td>
<td style='color: red'>".$fetch['alarmstatus']."</td>
<td>".$fetch['starttime']."</td>
<td>".$fetch['endtime']."</td>
<td><a href='includes/editalarm.php?id=".$fetch['id']."'>Edit</a></td>
<td><a href='includes/addevent.php?id=".$fetch['id']."'>Add event</a></td>
<td><a href='includes/deletealarm.php?id=".$fetch['id']."'>Delete</a></td>
</tr>";
}
the add event where i get the variable and make the query:
$alarmid = $_GET['id'];
$sql = "SELECT * FROM alarms WHERE id=".$alarmid;
$query = mysql_query($sql);
$fetch = mysql_fetch_array($query);
?>
the form:
<table cellpadding="2px" cellspacing="0" >
<form action="addevent.php" method="post">
<tr>
<td>סניף:</td>
<td><input style="width:200px; background-color: #d6d6d6;" readonly name="client" value="<?php echo $fetch['clientid']; ?>" /></td>
</tr>
<tr>
<td>בקר:</td>
<td><input style="width:200px; background-color: #d6d6d6;" readonly name="controller" value="<?php echo $fetch['controller']; ?>" /></td>
</tr>
<tr>
<td>אזעקה:</td>
<td><input style="width:200px; background-color: #d6d6d6;" readonly name="controller" value="<?php echo $fetch['typeid']; ?>" /></td>
</tr>
<tr>
<td>מוקדן:</td>
<td>
<?php
$sql = "SELECT * FROM users WHERE privilege = '2'";
$query = mysql_query($sql);
echo "<select name='user' style='width:207px;'>";
echo "<option>..</option>";
while ($fetch2 = mysql_fetch_array($query)){
echo "<option>".$fetch2['username']."</option>";
}
echo "</select>";
?>
</td>
</tr>
<tr>
<td>איש קשר:</td>
<td><input type="text" name="contact" /></td>
</tr>
<tr>
<td>הודעה:</td>
<td><input type="text" style="width:200px; height:100px" name="message" /></td>
</tr>
<tr>
<td>תשובה:</td>
<td><input type="text" style="width:200px; height:100px" name="answer" /></td>
</tr>
<tr>
<td>שעה:</td>
<td>
<select name="eventhour">
<option value ="default"></option>
<?php
for($i = 0; $i<60; $i++){
$value = $i;
if($i<=9){
$value= "0".$i;
}
echo "<option>".$value."</option>";
}
?>
</select>
<select name="eventminute">
<option value ="default"></option>
<?php
for($i = 0; $i<24; $i++){
$value = $i;
if($i<=9){
$value= "0".$i;
}
echo "<option>".$value."</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td>
<input type="submit" name="save" value="שמור" />
<input type="submit" name="cancell" value="בטל" />
</td>
<td></td>
</tr>
</form>
Your form action is POST. If you change that to GET then you will have the form as $_GET.

Categories