The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   Networking (http://hintsforums.macworld.com/forumdisplay.php?f=14)
-   -   PHP Button input (http://hintsforums.macworld.com/showthread.php?t=92755)

cwtnospam 08-11-2008 10:16 AM

2 Attachment(s)
Arrgh! I thought I had it working, but it doesn't work with Safari. :mad:

Safari won't check the buttons. Any ideas?

See images from Firefox and Safari below.

cwtnospam 08-11-2008 10:50 AM

Ok, this seems to work with FF, Camino & Safari. It even works with IE on Windows:

PHP Code:

<body>
<left><b>
<?php
$mystate 
$_POST['state'];
if (!
$mystate==""){
$theid substr($mystate,1);
$value substr($mystate,0,1);
mysql_connect("127.0.0.1""root""password") or die(mysql_error());
mysql_select_db("test") or die(mysql_error()) or die("A MySQL error has occurred.<br />Your Query: " $your_query "<br /> Error: (" mysql_errno() . ") " mysql_error());
mysql_query("UPDATE Employees SET inn = $value WHERE id = $theid") or die("A MySQL error has occurred.<br />Your Query: " $your_query "<br /> Error: (" mysql_errno() . ") " mysql_error()); 
} else {
mysql_connect("127.0.0.1""root""byteme") or die(mysql_error());
mysql_select_db("test") or die(mysql_error()) or die("A MySQL error has occurred.<br />Your Query: " $your_query "<br /> Error: (" mysql_errno() . ") " mysql_error());
}
$data mysql_query("SELECT * FROM Employees") or die(mysql_error());
?>
<table border cellpadding=3>
<?php
while($info mysql_fetch_array$data )) 
{
$value $info'inn' ];
$theid $info'id' ];
$v0 "0".$theid;
$v1 ="1".$theid;
Print 
'<th><align="left">'.$info'Name' ]."</td> <th></td>" 
if (
$value == 1) {

?>
<form method="post" action="inout.php" > 
<input type="radio" name="state" value="<?php echo $v1 ?>" CHECKED="CHECKED" onclick="this.form.submit();">in</input> 
<input type="radio" name="state" value="<?php echo $v0 ?>" onclick="this.form.submit();" >out</td><tr></input>
</form>
<?php

} else {

?>
<form method="post" action="inout.php" > 
<input type="radio" name="state" value="<?php echo $v1 ?>" onclick="this.form.submit();">in</input> 
<input type="radio" name="state" value="<?php echo $v0 ?>" CHECKED="CHECKED" onclick="this.form.submit();" >out</td><tr></input>
</form>
<?php
}

?>
</b>
</body>


baf 08-11-2008 12:23 PM

Possibly worth looking at frames? Then you could have several "sub pages".

cwtnospam 08-11-2008 02:37 PM

Maybe. On the other hand, I want it to easily refresh the list since some other computer may have updated the information.


All times are GMT -5. The time now is 09:41 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.