lyrico 23 Junior Poster in Training

you can use submit instead of button. try to analyze this code.

//assume that the file name of this script is test.php
<?php

 if($_POST['submit']=="Test")
 {
    echo "test";
 }

 echo "<form action='test.php' method='post'>";
 echo "<input type='submit' name='submit' value='Test'>";
 echo "</form>";
 
?>
pritaeas commented: well spotted +14
karthik_ppts commented: Yes +7
lyrico 23 Junior Poster in Training

I have same problem as samsnov. The problem can be call as cross browser issue. For example, when you run the script into IE, the design looks fine. But when you run it using FireFox, you can found many problem regarding its design.

Can anyone here give some advise or tip on how to solve cross browser issue?

lyrico 23 Junior Poster in Training

You can found that at the top of the comment text area. There a header "Has this thread been answered", just click "Mark this thread as solved" (underlined text).

lyrico 23 Junior Poster in Training

Anyway are you creating Log in script or a Sign up script?
But anyway, try this Jrotunda. (taga pinas ka ba?)

<?php
//maybe your need here something like...
$input_username = $_POST['username']; // user input. This is the value that will be check if already exist in the DB
$input_email = $_POST['email'];        // user input. This is the value that will be check if already exist in the DB
$SQL = mysql_query("SELECT Username from user");
while($result = mysql_fetch_array($SQL))
{
  $exist_username = $result['Username']'
  $exist_email = $result['Email']'
}

if($input_username == $exist_username || $input_email == $exit_email)
{
  echo "$input_username and/or $input_email already exist/used";
}

 
else
{

}
?>
lyrico 23 Junior Poster in Training

You can now mark this threads as solved ^^,

lyrico 23 Junior Poster in Training

Just put your update query at the top, so when the page was load, the script update first the record and then display the result.

Try the code below.

<?php
$con = mysql_connect("localhost","root","");

$sql = mysql_select_db("luweegee",$con);
?>
<html>
<head><link rel='stylesheet' type='text/css' href='Style.css'/></head>
	  <body>
	  <table border=0 align='center' width=900 cellpadding=20 cellspacing=0>
	  <tr><td  class='title' colspan=2><h1>Update Record</h1></td></tr>
 
		<tr>
		<td class='borderBaba' colspan=2></td>
		</tr>
 
<tr>
<td class='form' valign='top'>
<ul>
<a class='navigation' href='View.php'><li>View Record</li></a>
<a class='navigation' href='Add.php'><li>Add Record</li></a>	
<a class='navigation' href='Edit.php'><li>Edit Record</li></a>
<a class='navigation' href='Delete.php'><li>Delete Record</li></a>
</u>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</td>
 
 
<td class='Addstyles' valign='top'>
<table class='Addstyle' border=0 width=550 cellpadding=5 cellspacing=0>
 
<?php
// put the update query here.

if($_POST['submitEditForm'])
{
	$update = mysql_query("UPDATE resume SET name='$_POST[name]', age='$_POST[age]', sex='$_POST[sex]', mobile='$_POST[mobile]' WHERE id='$_POST[idnumber]'");
		}
echo"<form method='post' action='Edit.php'>
<tr>
		<td  class='viewTable1'><center>Name</center></td>
		<td  class='viewTable1'><center>Age</center></td>
		<td  class='viewTable1'><center>Sex</center></td>
		<td  class='viewTable1'><center>Mobile</center></td>
		<td  class='viewTable1'><center>Action</center></td>
</tr>
		";
	$sel = mysql_query("SELECT * FROM resume");
	while($data=mysql_fetch_array($sel))
		{
		echo "<tr>
				<td ><center>$data[name]</center></td>
				<td><center>$data[age]</center></td>
				<td><center>$data[sex]</center></td>
				<td><center>$data[mobile]</center></td>
				<td><center><input type='submit' value='Update' name='updateButt$data[id]'></center></td>
			  </tr>";
		}
 
	echo "</table></form>";
echo "<br><BR>";
 
		for($x=0;$x<=100;$x++)
		{
			if($_POST[updateButt.$x])
			{
			$select = mysql_query("SELECT * FROM resume WHERE id=$x");
				while($data=mysql_fetch_array($select))
				{
					echo "
					<form name='myform' method='post' action='Edit.php'>
					<table border=0 cellspacing=0 align='center' class='Addstyle'>
	<tr><td align='right' class='viewTable5' colspan=2><div class='textfile'>Editing: <span class='underline'>$data[name]</span></div></td></tr>
					<input size=20 type='hidden' value=$data[id] name='idnumber'>	
					<tr><td>Name: </td><td><input type='text' size=20 name='name'/></td></tr>
					<tr><td>Age: </td><td><input type='text' size=20 name='age'/></td></tr>
					<tr><td>Sex: </td><td><input type='text' size=20 name='sex'/></td></tr>
					<tr><td>Mobile: </td><td><input type='text' size=20 name='mobile'/></td></tr>
					<tr><td colspan=2><input type='submit' value='Submit' name='submitEditForm'/></td></tr>
 
				</table></form>
				";		
				}
			}
		}
 
		
 
?>
</td>
</tr>
<tr>
<td class='borderBaba' colspan=2 align='center'>
<br>Copyright 2011 ©  All Rights Reserved<br><br>
</tr>
</td>
</table>
</body>
</html>
lyrico 23 Junior Poster in Training

I modified your code. Take a look at the * sign.

* is partner with *, and ** is partner with **, and *** is partner with ***, and so on

The problem is you have { in your foreach, and yet you forgot to put } at the end of the foreach statement.

<?php
 
require_once("config.php");
 
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {//*
	die('Failed to connect to server: ' . mysql_error());
}//*
 
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {//**
	die("Unable to select database");
}//**
 
//Create query
$qry=("SELECT * FROM registrants");
$result=mysql_query($qry);
 
//Run through the records retrieved with the MySQL query.
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){//***
	//set a to the first week
	$a = 1;
	$output .= '<input name="id'. $row[id] . '" type="hidden" value="' . $row[id] . '" />'; //Setup the hidden input so each row has its own id.
	$output .= 'Name: ' . $row[f_name] . ' ' . $row[l_name]; //Output the first and last name with a space between them.
	$week = explode(",",$row[x]); //Turn row[x] into an array with the explode command, where x is the name of the field
	foreach ($week as $w){//**** //for every item in the array week do the following
		//Store the information into the variable output
		$output .= 'Week ' . $a .' 
		<select name="week'. $row[id] . '[]">
			<option value="Yes">yes</option>
			<option value="No">No</option>
			<option value="' . $w .'" selected="selected">' . $w .'</option>
		</select>';
	$a += 1}; //Increase the count by 1
}//**** this the problem
} //***
 
?>
lyrico 23 Junior Poster in Training

I'm not sure but I think the problem is that you did not define what is $id in your update query.

//if the user press the submitEditForm, where is the $id?
if($_POST['submitEditForm'])
{
// maybe you need here something like...
$id=$_POST['id'];
$update = mysql_query("UPDATE resume SET name='".$_POST["name".$id]."', age='".$_POST["age".$id]."', sex='".$_POST["sex".$id]."', mobile='".$_POST["mobile".$id]."' WHERE id='".$id."'");
 }

In your code, the script can not identify what record you want to update. Also, I'm not sure if your update query is correct. I mean, this is the first time I saw that kind of update query. Try to declare the value of $id and try to use my suggested update query. Since your activity is urgent, I think this is the last help i can offer for today.

lyrico 23 Junior Poster in Training

Try this update query;

mysql_query("UPDATE resume SET resume.name='$_POST[name]' WHERE id='".$id."')";
mysql_query("UPDATE resume SET resume.age='$_POST[age]' WHERE id='".$id."')";
mysql_query("UPDATE resume SET resume.mobile='$_POST[mobile]' WHERE id='".$id."')";
mysql_query("UPDATE resume SET resume.sex='$_POST[sex]' WHERE id='".$id."')";
lyrico 23 Junior Poster in Training

You can now mark this thread as "Solved"

lyrico 23 Junior Poster in Training

Try to use <br>

;
<?php

echo "Hello World!!"."<br>"."Im new to php";//sample 1

echo "Hello World!! <br> Im new to php";//sample 2
?>
lyrico 23 Junior Poster in Training

oopppssss. Sorry. I forgot to include the folder ^^

$images_folder = "images/";
<td><img src="<?php echo $images_folder.$image;?>"></td>
phpDave commented: correct answer +2
lyrico 23 Junior Poster in Training

Try this:

<td><img src="<?php echo $image;?>"></td>
lyrico 23 Junior Poster in Training

Try this:
1. Why don't create a page where your sql connection is coded. For example, create a php script and save it as connection.php and here is the code for it.

<?php
    	error_reporting(0);

	$connection = Mysql_connect('localhost','root','');
	mysql_select_db('test'); //test is the name of your database.
?>

Now analyze the modification that I made in this code.

<?PHP
      error_reporting(0);
      session_start();
      include 'connection.php' // call the connection for your database.

$critiria=$_POST['critiria'];
$search=$_POST['search'];

if($critiria=="epitheto_iatrou"){
$sql=mysql_query("SELECT * FROM doctors WHERE epitheto='$critiria'");
while($newarray=mysql_fetch_array($sql)){
echo "Epitheto: $newarray['epitheto'] <br>";
echo "Eidikotita: $newarray['eidikotita']<br>";
echo "Misthos: $newarray['misthos']<br>";
}
}

else if($critiria=="eidikotita"){
$sql=mysql_query("SELECT * FROM doctors WHERE eidikotita='$eidikotita'");
while ($newarray=mysql_fetch_array($sql)){
echo "Epitheto: $newarray['epitheto'] <br>";
echo "Eidikotita: $newarray['eidikotita']<br>";
echo "Misthos: $newarray['misthos']<br>";
}
}
else if($critiria=="epitheto_patient"){
$sql=mysql_query("SELECT * FROM patients WHERE epitheto='$critiria'");
while ($newarray=mysql_fetch_array($sql)){
echo "Epitheto: $newarray['epitheto'] <br>";
echo "Onoma: $newarray['onoma']<br>";
echo "id_doctor: $newarray['id_doctor']<br>";
echo "date: $newarray['date']<br>";
echo "poli: $newarray['poli']<br>";
}
}
else if ($critiria=="poli")
{
$sql=mysql_query("SELECT * FROM patients WHERE poli='$critiria'");
while ($newarray=mysql_fetch_array($sql)){
echo "Epitheto: $newarray['epitheto'] <br>";
echo "Onoma: $newarray['onoma']<br>";
echo "id_doctor: $newarray['id_doctor']<br>";
echo "date: $newarray['date']<br>";
echo "poli: $newarray['poli']<br>";
}
}
else if ($critiria=="date"){
$sql=mysql_query("SELECT * FROM patients WHERE date='$critiria'");
while ($newarray=mysql_fetch_array($sql)){
echo "Epitheto: $newarray['epitheto'] <br>";
echo "Onoma: $newarray['onoma']<br>";
echo "id_doctor: $newarray['id_doctor']<br>";
echo "date: $newarray['date']<br>";
echo "poli: $newarray['poli']<br>";
}
}

?>

The above query should work, but if not, try to eliminate "else" on "else if". Just make

if($critiria=="something")
{
  //blah blah blah
}
if($critiria=="something")
{
   //blah blah blah
}
lyrico 23 Junior Poster in Training

I modify the code again. ^^,

<?php
$username = 'username';
$password = 'password';
 
if (isset($_POST["username"]) && isset($_POST["password"]))
{
 
   // open text.txt for reading
    $file = fopen("text.txt","r");
 
   while (!feof($file))
   {
      $data = explode ("|", fgets($file));
   }
      if(isset($data[0]) && isset($data[1]))
      {
          if (trim($data[0]) == trim($_POST["username"]) && trim($data[1]) ==     trim($_POST["password"]))
          {
             $login = true;
             $_SESSION["login"] = $login;
             $_SESSION["username"] = $_POST["username"];
             //$_SESSION['type'] = $data[3];
             echo "Thank you for logging in, in 5 seconds you will be taken to the      homepage.";
             header("refresh: 5; private.php");
          break;
        }
      else
         {
              // something you want if the log in failed.
         }
 
    }
 

fclose($file);
}
?>
lyrico 23 Junior Poster in Training

I'm not so sure, but try this:

<?php
$username = 'username';
$password = 'password';

if (isset($_POST["username"]) && isset($_POST["password"]))
{

   // open text.txt for reading
    $file = fopen("text.txt","r");

   while (!feof($file))
   {
      $data = explode ("|", fgets($file));
      if(isset($data[0]) && isset($data[1])){
      if (trim($data[0]) == trim($_POST["username"]) && trim($data[1]) ==     trim($_POST["password"]))
      {
          $login = true;
          $_SESSION["login"] = $login;
          $_SESSION["username"] = $_POST["username"];
          //$_SESSION['type'] = $data[3];
          echo "Thank you for logging in, in 5 seconds you will be taken to the     homepage.";
          header("refresh: 5; private.php");
          break;
        }
      else
         {
              // something you want if the log in failed.
         }

    }

}
fclose($file);
}
?>
lyrico 23 Junior Poster in Training

I think you can save the image on the server drives but not on the database itself. The path of the image is the one that saves in the database.

lyrico 23 Junior Poster in Training

Try this.

<?PHP
$query=mysql_query("SELECT * FROM call_details WHERE !ISNULL(call_project_name)");
echo "<select name='detailr'>";
while($row=mysql_fetch_array($query))
{
echo "<option value='$row[call_id]'>".$row."</option>";
}
echo "</select>";
?>

lyrico 23 Junior Poster in Training

Try this query

$insert = mysql_query("INSERT INTO mystuff.pageser (name,content) VALUES('$content_name','$content') where user_id = '$colname_Recordset1'"));
lyrico 23 Junior Poster in Training

$query_Directory_update = "update directory set Sno=<?php $Directory_update; ?>where Sno='$_GET[updateid]'";

try to modified the above code into this:

$query_Directory_update = mysql_query("update directory set directory.Sno='$Directory_update[Sno]' where Sno='".$_GET[updateid]."'");

I think you don't have any PHP error with that query, but I'm not so sure if the query successfully update the record, since I don't know what is the exact variable from your database and PHP code itself.