hielo 65 Veteran Poster

If you are viewing the output/result via a browser then try:

echo "<div style='text-align:center;'>Successfuly sent</div>";
hielo 65 Veteran Poster

based on this:

Notice: Undefined index: page in C:\wamp\www\webdesigning1\webdesigning1\inc\index.php on line 28

my guess is that you have the post above in:
C:\wamp\www\webdesigning1\webdesigning1\inc\index.php

But it should be in:
C:\wamp\www\webdesigning1\webdesigning1\index.php

OR if you want to retain that code in:
C:\wamp\www\webdesigning1\webdesigning1\inc\index.php

then change $path = "inc/".$page.".php"; to $path = $page.".php";

hielo 65 Veteran Poster

line 26 should be { line 28 should be } also, you are missing the closing brace } for the first if Try:

<html>
<table width='70%' align='center'>
<tr>
<td>
<img src='inc/b.png'>
</td>
</tr>
</table>
<table width='20%' align='center'>
<tr>
<td>
<a href='index.php'>Home</a><br>
<a href='index.php?page=tutorials'>Tutorials</a>
</td>
<td width='80%'>
<?php
if( isset($_GET['page']) && !empty($_GET['page']) )
{
	$page=$_GET['page'];
	$path = "inc/".$page.".php";
	if (file_exists($path))
	{
		include($path);
	}
	else
	{//<-- should NOT be parenthesis
		echo"Page doesn't exist.";
	}//<-- should NOT be parenthesis
}//<-- you are missing this
?>
</td>
</tr>
</table>
</html>
hielo 65 Veteran Poster

line 27 is missing a semicolon at the end: echo"Page doesnt exist.";

hielo 65 Veteran Poster

try "APPENDING" the text. If you just swap the lines you have, then you would be overwriting the textarea with the text:

var table = document.getElementById(tableID); 
	var rowCount = table.rows.length;
	var row = table.insertRow(rowCount);  
	
	var cella = row.insertCell(0);
	cella.style.backgroundColor = "EAEAEA";
	var element1 = document.createElement("textarea");
	element1.cols = "9";
	element1.rows = "3";
	element1.name = "txtDescription[]";
	element1.size = "10";
	cella.style.fontWeight = "Bold";
	cella.appendChild(element1);
	cella.innerHTML += "UNIT ";
hielo 65 Veteran Poster

Try:

xmlString ="<Chart:Bullet xmlns:Chart='http://yoursite.com' values='100,200' size='100x20' shading='5' ></Chart:Bullet>";

XmlDocument doc = new System.Xml.XmlDocument();
      
doc.LoadXml(xmlString);

//Instantiate an XmlNamespaceManager object. 
System.Xml.XmlNamespaceManager xmlnsManager = new System.Xml.XmlNamespaceManager(xmldoc.NameTable);

//Add the namespaces used in books.xml to the XmlNamespaceManager.
xmlnsManager.AddNamespace("Chart", "http://yoursite.com");

Additionally, the following resources may be of interest to you:
http://support.microsoft.com/kb/318545
http://stackoverflow.com/questions/331568/how-do-i-add-multiple-namespaces-to-the-root-element-with-xmldocument
http://stackoverflow.com/questions/310669/why-does-c-xmldocument-loadxmlstring-fail-when-an-xml-header-is-included

hielo 65 Veteran Poster

If you have an input element of type="file" whose name="photo" then you should be using $_FILES['photo']['name'] since $_FILES['photo'] would actually be an array.

$TARGET_PATH="pics/";
$TARGET_PATH =$TARGET_PATH . $_FILES['photo']['name'] . '.jpg';
while (file_exists($TARGET_PATH))
    {
$TARGET_PATH =$TARGET_PATH .  $_FILES['photo']['name']. uniqid() . '.jpg';
}
hielo 65 Veteran Poster

I didnt think the array added garbage...

there is not "garbage" added "automatically". Most likely the data you are reading are on lines by themselves. Each line ends with a newline character, so when you read it in, that newline character (\n) is also included as part of $userPrefs[0] and $userPrefs[1] .

hielo 65 Veteran Poster

try:

$query="SELECT fieldId FROM table WHERE (fieldName IS NULL) OR (''=trim(fieldName) )";
hielo 65 Veteran Poster

Make sure there are no leading nor trailing blank characters. Try:

$realUser = trim($userPrefs[0]);
$realPass = trim($userPrefs[1]);
hielo 65 Veteran Poster

use the attr() method:
http://api.jquery.com/attr/

If you have
<div id="myid1" class="myid">Data1</div>
<div id="myid2" class="myid">Data2</div>


alert( $('.myid:eq(0)').attr('id') );
hielo 65 Veteran Poster

Ids must be unique, so you will need to change the id of at least one of them or you will likely experience cross-browser incompatibilities. However, it is OK to have multiple elements with the same class name. So, if you change those id='myid' to class='myid' then use $('.myid:eq(0)').html() to get the innerHTML of the first div. For the second div, change the zero to a ONE.

hielo 65 Veteran Poster

Try using:

$result=mysql_query( $sql ) or die( mysql_error() );

Instead so you can determine what is causing the error.

hielo 65 Veteran Poster

On memberpage.php you need:

<?php
session_start();
echo "hi, {$_SESSION['myusername']}!";
?>
hielo 65 Veteran Poster

assuming the name of your table is Account, try

<?php
include "connecttodb.php";
 $name = mysql_real_escape_string( $_POST['name']);
 $email = mysql_real_escape_string($_POST['email']);
 $password = mysql_real_escape_string($_POST['pass']);

 $query = "INSERT INTO Account( username,password,email) VALUES('$name', '$password', '$email')";

 mysql_query($query)
 or die('There was an error in your registration');

 echo'Registration Complete!';

 mysql_close();
 ?>
hielo 65 Veteran Poster

Try:

<?php
session_start();
include('dbconnect.php');

$tbl_name="members"; 

$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
 
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql) or die(mysql_error());

$count=mysql_num_rows($result);

if($count==1){
//session_register("myusername");
//session_register("mypassword");
$_SESSION['myusername']=$myusername;

header("location:memberpage.php");
exit;
}
else {
echo "Wrong Username or Password";
}
?>
hielo 65 Veteran Poster

On line 46 you mistyped topPos

hielo 65 Veteran Poster

On line 11 you are using CustomerId, but it is NOT initialized yet. You need to initialize it first.

Also, try changing line 38 to: fadeimages[counter]=["images/<%=CustomerId & "/" & objItem.Name %>", "", ""]

hielo 65 Veteran Poster

You can incorporate checkboxes to the left of the name lists. Let's call it a DELETE column. If an item is checked, then delete that item. So your interface can be:

/*
Delete  Name
[]      John
[x]     Bob
[]      Sue
Assignment: [_Select an assignment_]
Person: _Frank__
{Submit}


Your checkboxes would basically be:
*/
<input type="checkbox" name="delete[]" value="1"/> John
<input type="checkbox" name="delete[]" value="12"/> Bob
<input type="checkbox" name="delete[]" value="34"/> Sue

Where the values 1, 12, AND 34 are the UNIQUE use ids for John, Bob, and Sue respectively.

On the above, when you submit, you should first look for the checked items and delete them from the SELECTED assignment:

hielo 65 Veteran Poster

See if you can locate a Page_Load() function on your server-side code and see if it is the one doing the redirection.

Otherwise look for a browser-side __doPostBack() javascript function

hielo 65 Veteran Poster

try: onclick="aster( document.getElementById('fn'), document.getElementById('ast1') )"

hielo 65 Veteran Poster

It seems that $row[0] and $row[1] contain Arrays, NOT the numeric value you think they have. Try using:
assuming they are INDEXED arrays, try $row[0][0] and $row[1][0] instead.

hielo 65 Veteran Poster

Let's say that you are browsing "aboutUs.asp" AND that it contains one of those problematic links. Look at the browser's source code. Does the link in question have href="http://liveserver.com" ?if so, it is not a server configuration problem. Otherwise, also look for <base href="http://liveserver.com"> . if you find it then it is not a server configuration problem, in which case you wil need to make the needed changes within your scripts

hielo 65 Veteran Poster

i have found a free php email form

Where did u find this? I wonder if there's a "manual" for it.

Also, can you clarify what you mean by "redirect the title "

hielo 65 Veteran Poster

Glad to help.

Regards,
Hielo

PS: Don't forget to mark the thread as solved.

hielo 65 Veteran Poster

All you need is a list of all the assignments AND an empty field for your to enter/add Bob to Person. As soon as you add Bob to Person, get the new id for Bob and add it to GroupAssignment along with the id of his assignment:

<?php
if( isset($_POST) && !empty($_POST) )
{
   $assignment=intval($_POST['assignment']);

   //connect to db here
   //...


   if( $assignment > 0 )
   {
      //update your Assignment title here
      mysql_query("Update Assignment SET title='".mysql_real_escape_string($_POST['title'])."' WHERE id=".$assignment) or die( mysql_error() );

   echo "Assignment Title has been updated<br />";
   }

   if( $assignment > 0 && isset($_POST['person']) && !empty($_POST['person']) )
   {
      mysql_query("INSERT INTO Person('Name') VALUES('".mysql_real_escape_string($_POST['person'])."') ") or die(mysql_error());
      
      mysql_query("INSERT INTO GroupAssignment(Person_id,Assignment_id,SubmissionDate) VALUES(" . $assignment . "," . mysql_insert_id() . ",'".date('Y-m-d')."')" or die(mysql_error());
   }
   echo 'New member added<br />';
}

$result=mysql_query("SELECT id,title FROM Assignment") or die( mysql_error() );
$assignments='<select name="assignment"><option value="">Make a selection</option>';
while( $row=mysql_fetch_assoc($result) )
{
  $assignments.=sprintf('<option value="%s">%s</option>', $row['id'], htmlentities($row['title'], ENT_QUOTES) );
}
$assignments='</select>';
echo <<<FORM
<form method="post" action="{$_SERVER['PHP_SELF']}">
Assignment: {$assignments}<br />
Person: <input type="text" name="person" value="" /><br />
<input type="submit" name="Send" value="Add and Update"/>
</form>
FORM;
?>
hielo 65 Veteran Poster

On those string parameters, include the size of the fields as the fourth parameter.
EX: assuming that NameStr is defined (in your DB Table) to be of size 100, try: call sp.addParam("@NameStr", 200, 1, [B]100[/B],"Stuff and Things")

hielo 65 Veteran Poster
<?php
//your page must start by calling session_start() first:
session_start();

//THEN you can begin saving data onto $_SESSION
//assuming that in YOUR example, $details is an array - ex:
$details=array('firstName'=>'john', 'lastName'=>'doe');

//then you just assign the array to $_SESSION
$_SESSION['ecart']=$details;
?>

page2.php
<?php
//If you need to retrieve the $_SESSION in page2.php, you MUST call session_start() first
session_start();

echo $_SESSION['ecart']['firstName'];
?>
hielo 65 Veteran Poster

Is it correct?

No!
a.) To delimit the strings you can use either DOUBLE QUOTES (") OR APOSTROPHES('). You are using the backtick(`) which is NOT correct
b.) On the document.write() you need to separate different string using a comma(,) NOT a semicolon( ; )

hielo 65 Veteran Poster

<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?> should appear only ONCE in the document. Currently you are appending that within your WHILE construct, so you are generating that multiple times. Move it OUTSIDE you while construct so that it is BEFORE the root/top-most element (basically between lines 8 and 9 in your markup).

hielo 65 Veteran Poster

Ideally `Group Member` should have just ONE value. So instead of one RECORD such as : Title 1 John, Sue, Amir 2010-10-10 You would need to enter THREE (each separately):

Title 1         John       2010-10-10
Title 1         Sue        2010-10-10
Title 1         Amir       2010-10-10

Read
http://en.wikipedia.org/wiki/First_normal_form

(pay special attention to the "Repeating Groups" section). My suggestion would be:

Person
id	Name
1	John
2	Sue
3	Amir
4	Bob

Assignment
id	title
1	Title 1
2	Title 2
3	Title 3

GroupAssignment
Assignment_id	Person_id	SubmissionDate
1		1		2010-10-10
1		2		2010-10-10
1		3		2010-10-10
2		1		2010-10-09
2		2		2010-10-09
2		4		2010-10-09
3		4		2010-10-06
3		2		2010-10-06
3		3		2010-10-06

And as far as the multiple selection box goes, Yes, you can still use it. You just need to make sure that when you receive those multiple selected values, you "break" them apart and insert each value as its own record in GroupAssignment.

hielo 65 Veteran Poster

i've detected the problem where my sql statement only call once for each assignments

You are seeing the correct results. Your query is returning all the relevant rows. The problem is in your DB design.

I hope anyone can help me without changing or upgrading my database..

Why would you want to impose this restriction when your DB design is the problem? If you really want to stick with your flawed design, what you need to do is when you retrieve the result, for every row, you will need to split 'Group Member' at the comma and then generate the rows you seek.

hielo 65 Veteran Poster

create cookie (ex: lastPageLoaded), and whenever you make an ajax request, upon successful retrieval of your content, update the cookie to the url you used last.

So, upon page load you just need to see if the cookie exists, If yes, load the page/content from whatever url is in the cookie. If not, then load your default page/content.

If you are using jquery, there's a cookie plugin that is very easy to use:
https://github.com/carhartl/jquery-cookie/blob/master/jquery.cookie.js

hielo 65 Veteran Poster

AFTER successful execution of line 11, $sql contains a resource NOT a string - so line 28 doesn't make sense. You need to extract the data from the resource ($sql) returned by your query. It is not clear to me which field in $sql you are interested in , but assuming that in your DB Table you have a field named 'mysteryField', then what you need to do is:

//try not to doe SELECT * if you are NOT going to use all your fields
$sql = mysql_query("SELECT `mysteryField` FROM `user` WHERE `username` = '$username'") or die( mysql_error() );

$row=mysql_fetch_assoc($sql);
...
$uploadfile=$row['mysteryField'].$ext;

/* you don't need this. If I upload 'hi.txt' and you want it renamed to 'bye.rtf' you just need to specify the NEW name as the second argument to move_uploaded file which you are ALREADY DOING.
//rename the file to the new one
@rename($file,$uploadfile); 
*/
if(move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)){
...
}
hielo 65 Veteran Poster

search for articles on CURL:

<?php
if( isset($_POST['send']) )
{
	//Connect to DB server
	$conn = mysql_connect('localhost','root','') or die(mysql_error());

	//Select database
	mysql_select_db('ems',$conn) or die(mysql_error());


	$FName = mysql_real_escape_string($_POST['FName']);
	$LName = mysql_real_escape_string($_POST['LName']);

	$sql = "INSERT INTO `ems`.`tbl_dummy` (`FName`, `LName`) VALUES ('$FName', '$LName');";
	mysql_query($sql) or die(mysql_error());
	
	$params=array();
	$params[]="FName=".urlencode($_POST['FName']);
	$params[]="LName=".urlencode($_POST['LName']);

	$ch = curl_init(POSTURL);
	curl_setopt($ch, CURLOPT_POST ,1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $params) );
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION  ,1);
	curl_setopt($ch, CURLOPT_HEADER      ,0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER  ,1);
	$data = curl_exec($ch);
}
else
{
	$data=<<<BLANKFORM
	<form action="{$_SERVER['PHP_SELF']}" method="post" enctype="application/x-www-form-urlencoded" id="frm_test">
		<label>First Name: </label><input name="FName" type="text" /><br />
		<label>Last Name: </label><input name="LName" type="text" /><br  />
		<input name="send" type="submit" value="Save" />
	</form>
BLANKFORM;

}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>PHP TO ASP :: testing only</title>
</head>
<body>
<?php echo $data; ?>
</body>
</html>
Krammig commented: Nice +0
hielo 65 Veteran Poster

wat to do i want to show particular image from database.

You need to know the id of the image you are interested in ahead of time. So if you know that you are interested in the image whose id=3, assuming that the code I posted above is named imageRetriever.php, then in you HTML page you need to put:

<img src="http://yoursite.com/imageRetriever.php?id=3" alt="" />
hielo 65 Veteran Poster

Glad to help.

Regards,
Hielo

PS: Don't forget to mark the thread as solved.

hielo 65 Veteran Poster
newData="test";
if($('input[name="' + newData + '"]').is(":checked"))
{
 // my other code
}
hielo 65 Veteran Poster

assuming your image table had fields image AND also id:

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

if( isset($_GET['id']) && is_numeric($_GET['id']) && intval($_GET['id'])>0 )
{
	$sql="select image FROM image where id=" . intval($_GET['id']) . ' LIMIT 1';
	$res=mysql_query($sql) or die(mysql_error());
	$row=mysql_fetch_assoc($res);
	header('Content-Type: image/jpeg');
	echo $row['image'];
	exit;
}
else
{
	$sql="select id FROM image";
	$res=mysql_query($sql) or die(mysql_error());
	while( $row=mysql_fetch_assoc($res) )
	{
		echo '<img src="'.$_SERVER['PHP_SELF'].'?id='.$row['id'].'" alt="" />';
	}
}
?>
hielo 65 Veteran Poster

On line 34 you are attempting to submit the hidden form, BUT at that point, there is no such form defined/seen by the browser yet because you begin the definition until line 45. What you need to do is call that function AFTER you have closed the hidden form

OR upon page load:

print('<script type="text/javascript">window.onload=submitForm;</script>');
hielo 65 Veteran Poster

OK, so if you know HTML, then you should know that the syntax for an image is:

<img src="http://yoursite.com/" alt="some image description here"/>

What you need to do is make sure that the [B]SRC[/B] attribute points to some php page (let's call it imageRetriever.php) and that each url contains a unique ID to the image you want - ex:

<!-- You need to update the code you posted above so that it generates the following markup for EACH of the images. Given my example below, the assumption is that there would be only three images in your query result, but in your case it may be more or less. The 3, 12, and 47 I chose at random, but in your case these would be the unique ids for each of your images. -->
<img src="http://yoursite.com/imageRetriever.php?id=3" alt=""/>
<img src="http://yoursite.com/imageRetriever.php?id=12" alt=""/>
<img src="http://yoursite.com/imageRetriever.php?id=47" alt=""/>

Then in imageRetriever.php you need to use $_GET['id'] and use that value to query the db and send the binary data with the appropriate content-type (basically what you have above, but you need to do it for the reqquested image)

hielo 65 Veteran Poster

Are you trying to view the images via an HTML page? If yes, do you know what is the SYNTAX for an HTML Image?

hielo 65 Veteran Poster
hielo 65 Veteran Poster

try changing: if (null == server_msg) to: if (!/a-z/i.test(server_msg))

hielo 65 Veteran Poster
$str = "I will go to the store with <# one/two/three #> people<# four/five/six #>.";
if( preg_match_all( '![<]#([^#]+)#[>]!',$str,$matches) )
{
	$id=0;
	$prefix='place_';
	foreach($matches[1] as $group=>$str)
	{
		$parts=explode('/',$str);
		foreach($parts as $v)
		{
			++$id;
			$v=trim($v);
			echo PHP_EOL.'<input type="radio" id="'.$prefix.$id.'" name="'.$prefix.$group.'" value="'.$v.'" /><label for="'.$prefix.$id.'">'.ucfirst($v)."</label>";
		}
	}
}
hielo 65 Veteran Poster

http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

echo <<<EOS
Your garbled string goes here
EOS;
//IMPORTANT: The line above ends with a semicolon followed by newline.These are required
hielo 65 Veteran Poster

try adding or die() to get more details about the error:

<?php
		$mysql_id = mysql_connect('mysql3.000webhost.com', 'a2778852_556875', 'pendolino390') or die( sprintf('Line %d: %s',__LINE__, mysql_error() ) );
	mysql_select_db('a2778852_555676', $mysql_id) or die( sprintf('Line %d: %s',__LINE__, mysql_error() ) );
	
	$result = mysql_query("SELECT `personalexperience`, `sex`, `age`, `sexuality` FROM `Personal_experience`") or die( sprintf('Line %d: %s',__LINE__, mysql_error() ) ) ;
	
	
	while($row = mysql_fetch_assoc($result))
	  {
	  echo $row['personalexperience'], $row['sex'], $row['age'],  $row['sexuality'];	 
	  }
	  
	  mysql_close($mysql_id);
	?>
hielo 65 Veteran Poster
hielo 65 Veteran Poster

Do you know any formula for that threshold???

No

hielo 65 Veteran Poster

That concatenates strings, which is not what you asked.