<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>PHPBuilder.com - Newbies</title>
		<link>http://board.phpbuilder.com/</link>
		<description>Help for those who are just getting started</description>
		<language>en</language>
		<lastBuildDate>Wed, 19 Jun 2013 04:00:34 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://board.phpbuilder.com/images/misc/rss.png</url>
			<title>PHPBuilder.com - Newbies</title>
			<link>http://board.phpbuilder.com/</link>
		</image>
		<item>
			<title>results into an array</title>
			<link>http://board.phpbuilder.com/showthread.php?10390031-results-into-an-array&amp;goto=newpost</link>
			<pubDate>Tue, 18 Jun 2013 14:23:55 GMT</pubDate>
			<description><![CDATA[Hi 
I have a sql query that results in the likes of 
123/456/789 

i need to be able to break the above result up into variables without the / ie var1=123 var2=456 var3=789 i gather this would be in to an array but im not sure how to get the details before & after the / in the result 

can anyone help please 

many thanks]]></description>
			<content:encoded><![CDATA[<div>Hi <br />
I have a sql query that results in the likes of <br />
123/456/789 <br />
<br />
i need to be able to break the above result up into variables without the / ie var1=123 var2=456 var3=789 i gather this would be in to an array but im not sure how to get the details before &amp; after the / in the result <br />
<br />
can anyone help please <br />
<br />
many thanks</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>neroag</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10390031-results-into-an-array</guid>
		</item>
		<item>
			<title>form submit redirect inside WP Plugin</title>
			<link>http://board.phpbuilder.com/showthread.php?10390023-form-submit-redirect-inside-WP-Plugin&amp;goto=newpost</link>
			<pubDate>Mon, 17 Jun 2013 22:51:17 GMT</pubDate>
			<description><![CDATA[Hi all, Please don't bash me. I have spent hours and hours, days and days. I can't get this stupid thing to work right.

The plugin is inside of wp which makes it own headers so making it almost impossible for me to understand.

I have tried Action"", Target"" and many things in between. I got it to open a new window but was same page not the page I was trying to get to load. I want it to open in same window with a new page.

My form has multi .php pages that collect data. But the first php page need to redirect to a new page and continue to submit data.

I did see this post that was something like my issue.

http://board.phpbuilder.com/showthread.php?10315953-post-data-via-redirect-without-curl

here is the page I have.
http://simplecarrentals.co.nz/home/

here is where I want to goto on submit.
http://simplecarrentals.co.nz/book-a-car-now/

I am not asking any one to build my site. I just really need direction in how to fix or find the issue.
I know it is a really simple issue to fix. Just I have no clue how it is done.]]></description>
			<content:encoded><![CDATA[<div>Hi all, Please don't bash me. I have spent hours and hours, days and days. I can't get this stupid thing to work right.<br />
<br />
The plugin is inside of wp which makes it own headers so making it almost impossible for me to understand.<br />
<br />
I have tried Action&quot;&quot;, Target&quot;&quot; and many things in between. I got it to open a new window but was same page not the page I was trying to get to load. I want it to open in same window with a new page.<br />
<br />
My form has multi .php pages that collect data. But the first php page need to redirect to a new page and continue to submit data.<br />
<br />
I did see this post that was something like my issue.<br />
<br />
<a rel="nofollow" href="http://board.phpbuilder.com/showthread.php?10315953-post-data-via-redirect-without-curl" target="_blank">http://board.phpbuilder.com/showthre...t-without-curl</a><br />
<br />
here is the page I have.<br />
<a rel="nofollow" href="http://simplecarrentals.co.nz/home/" target="_blank">http://simplecarrentals.co.nz/home/</a><br />
<br />
here is where I want to goto on submit.<br />
<a rel="nofollow" href="http://simplecarrentals.co.nz/book-a-car-now/" target="_blank">http://simplecarrentals.co.nz/book-a-car-now/</a><br />
<br />
I am not asking any one to build my site. I just really need direction in how to fix or find the issue.<br />
I know it is a really simple issue to fix. Just I have no clue how it is done.</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>carbincopy</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10390023-form-submit-redirect-inside-WP-Plugin</guid>
		</item>
		<item>
			<title><![CDATA[PHP mail with gmail > edit "from email address"?]]></title>
			<link>http://board.phpbuilder.com/showthread.php?10390007-PHP-mail-with-gmail-gt-edit-quot-from-email-address-quot&amp;goto=newpost</link>
			<pubDate>Sun, 16 Jun 2013 08:58:27 GMT</pubDate>
			<description><![CDATA[Hi,

I managed to set up a simple smtp with sendmail and gmail in the PHP mail function. The thing is, is it possible to change the "from" email address to a different one, than the gmail account I'm using?

No matter which $from I assign, the from address is always my gmail account, which I am using to send mails.

Thanks]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I managed to set up a simple smtp with sendmail and gmail in the PHP mail function. The thing is, is it possible to change the &quot;from&quot; email address to a different one, than the gmail account I'm using?<br />
<br />
No matter which $from I assign, the from address is always my gmail account, which I am using to send mails.<br />
<br />
Thanks</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>skyhrg</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10390007-PHP-mail-with-gmail-gt-edit-quot-from-email-address-quot</guid>
		</item>
		<item>
			<title>wtf unexpected $end, and I did nothin wrong!</title>
			<link>http://board.phpbuilder.com/showthread.php?10389983-wtf-unexpected-end-and-I-did-nothin-wrong!&amp;goto=newpost</link>
			<pubDate>Thu, 13 Jun 2013 20:18:46 GMT</pubDate>
			<description><![CDATA[omg it's drivin me crazy 3 days or 4 already I stopped counting...

please guy take a look and try n help me:


PHP:
---------
<?php
include('config.php');


if(MODULE == 'none')
{  
	include(LOVE_ROOT . '/system/love_head.php');    
	$content = '<h2> &#1492;&#1512;&#1513;&#1502;&#1492; </h2><br />';




	ob_start();


	echo '<html dir="rtl"><head><title></title>';
	echo '<meta http-equiv="Content-Type" content="text/html charset=windows-1255" /></head><body><br /><br />';
	
if(empty($_POST['sub']))
{
?>
<form method="post">
<table>
<tr><td>&#1513;&#1501; &#1508;&#1512;&#1496;&#1497;</td><td><input type="text" name="fname"></td></tr>
<tr><td>&#1505;&#1497;&#1505;&#1502;&#1488;</td><td><input type="password" name="pass"></td></tr>
<tr><td>&#1488;&#1497;&#1502;&#1493;&#1514; &#1505;&#1497;&#1505;&#1502;&#1488;</td><td><input type="password" name="repass"></td></tr>
<tr><td>&#1488;&#1497; &#1502;&#1497;&#1497;&#1500;</td><td><input type="text" name="email"></td></tr>
<tr><td colspan="2" align="center"><input type="submit" name="sub" value="&#1492;&#1512;&#1513;&#1502;&#1492;"></td></tr>
</table>
</form>
<?php
}
else
{
$fname = $_POST['fname'];
$password = $_POST['pass'];
$repassword = $_POST['repass'];
$email = $_POST['email'];
$date = date('Y-m-d');

$pass1 = md5($password);
$pass = sha1($pass1);

$select = mysql_query("SELECT * FROM `users` WHERE fname='$fname'");

$cu = mysql_fetch_array($select);

$select3 = mysql_query("SELECT * FROM `admins` WHERE fname='$fname'");

$cu3 = mysql_fetch_array($select3);

$select2 = mysql_query("SELECT * FROM `users` WHERE email='$email'");

$cu2 = mysql_fetch_array($select2);

echo "<center>";

if(empty($cu) AND empty($cu) AND $password == $repassword)
{
if (strlen($fname) < 3 OR strlen($fname) > 12)
{
echo "<font color='darkred'><b>";
echo "&#1513;&#1490;&#1497;&#1488;&#1492; - &#1492;&#1513;&#1501; &#1492;&#1508;&#1512;&#1496;&#1497; &#1513;&#1489;&#1495;&#1512;&#1514; &#1488;&#1512;&#1493;&#1498;/&#1511;&#1510;&#1512; &#1502;&#1491;&#1497;";
echo "</b></font>";
echo "<br><br>";
?>
<input type="button" value="&#1495;&#1494;&#1493;&#1512; &#1488;&#1495;&#1493;&#1512;&#1492;" onclick="window.location.href='java_script:window.history.back(-1)';">
<?php
}

else if (strlen($password) < 3 OR strlen($password) > 12)
{
echo "<font color='darkred'><b>";
echo "&#1513;&#1490;&#1497;&#1488;&#1492; - &#1492;&#1505;&#1497;&#1505;&#1502;&#1488; &#1488;&#1512;&#1493;&#1499;&#1492;/&#1511;&#1510;&#1512;&#1492; &#1502;&#1491;&#1497;";
echo "</b></font>";
echo "<br><br>";
?>
<input type="button" value="&#1495;&#1494;&#1493;&#1512; &#1488;&#1495;&#1493;&#1512;&#1492;" onclick="window.location.href='java_script:window.history.back(-1)';">
<?php
}

else if (!empty($cu2))
{
echo "<font color='darkred'><b>";
echo "&#1513;&#1490;&#1497;&#1488;&#1492; - &#1492;&#1488;&#1497; &#1502;&#1497;&#1497;&#1500; &#1514;&#1508;&#1493;&#1505;";
echo "</b></font>";
echo "<br><br>";
?>
<input type="button" value="&#1495;&#1494;&#1493;&#1512; &#1488;&#1495;&#1493;&#1512;&#1492;" onclick="window.location.href='java_script:window.history.back(-1)';">
<?php
}

else if (stristr($email, "@") == false OR stristr($email, ".")== false)
{
echo "<font color='darkred'><b>";
echo "&#1513;&#1490;&#1497;&#1488;&#1492; - &#1492;&#1488;&#1497; &#1502;&#1497;&#1497;&#1500; &#1500;&#1488; &#1514;&#1511;&#1497;&#1503;";
echo "</b></font>";
echo "<br><br>";
?>
<input type="button" value="&#1495;&#1494;&#1493;&#1512; &#1488;&#1495;&#1493;&#1512;&#1492;" onclick="window.location.href='java_script:window.history.back(-1)';">
<?php
}

else
{
$insert = mysql_query("INSERT INTO `users` VALUES ('','$fname','$pass','$email','0','','$date','0')");

setcookie('adv_U',$fname);
setcookie('adv_P',$pass);
Header('Location: index.php');
}
}
else if ($password != $repassword)
{
echo "<font color='darkred'><b>";
echo "&#1513;&#1490;&#1497;&#1488;&#1492; - &#1488;&#1497;&#1502;&#1493;&#1514; &#1505;&#1497;&#1505;&#1502;&#1488; &#1513;&#1490;&#1493;&#1497;";
echo "</b></font>";
echo "<br><br>";
?>
<input type="button" value="&#1495;&#1494;&#1493;&#1512; &#1488;&#1495;&#1493;&#1512;&#1492;" onclick="window.location.href='java_script:window.history.back(-1)';">
<?php
}
else
{
echo "<font color='darkred'><b>";
echo "&#1513;&#1490;&#1497;&#1488;&#1492; - &#1513;&#1501; &#1508;&#1512;&#1496;&#1497; &#1514;&#1508;&#1493;&#1505;";
echo "</b></font>";
echo "<br><br>";
?>
<input type="button" value="&#1495;&#1494;&#1493;&#1512; &#1488;&#1495;&#1493;&#1512;&#1492;" onclick="window.location.href='java_script:window.history.back(-1)';">
<?php
}
}
?>
</body>
</html>
<?php
ob_end_flush();
?>
<?php
?>
<br /> <br /> <br /> 	
		
		';
	
	include(LOVE_ROOT . '/system/love_foot.php');
}
else
{
	header('Location: modules/' . MODULE);
}
?>
---------


it dirrects me to line number 164, (the last line of the code), and "unexpected $end"...

????? what is going on here? it's a simple Sign Up code + few php's I added for the overall design and form around...

please guys, thanks alot!]]></description>
			<content:encoded><![CDATA[<div>omg it's drivin me crazy 3 days or 4 already I stopped counting...<br />
<br />
please guy take a look and try n help me:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">include(</span><span style="color: #DD0000">'config.php'</span><span style="color: #007700">);<br /><br /><br />if(</span><span style="color: #0000BB">MODULE&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">'none'</span><span style="color: #007700">)<br />{&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;include(</span><span style="color: #0000BB">LOVE_ROOT&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'/system/love_head.php'</span><span style="color: #007700">);&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$content&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'&lt;h2&gt;&nbsp;&#1492;&#1512;&#1513;&#1502;&#1492;&nbsp;&lt;/h2&gt;&lt;br&nbsp;/&gt;'</span><span style="color: #007700">;<br /><br /><br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ob_start</span><span style="color: #007700">();<br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&lt;html&nbsp;dir="rtl"&gt;&lt;head&gt;&lt;title&gt;&lt;/title&gt;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'&lt;meta&nbsp;http-equiv="Content-Type"&nbsp;content="text/html&nbsp;charset=windows-1255"&nbsp;/&gt;&lt;/head&gt;&lt;body&gt;&lt;br&nbsp;/&gt;&lt;br&nbsp;/&gt;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />if(empty(</span><span style="color: #0000BB">$_POST</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'sub'</span><span style="color: #007700">&#93;))<br />{<br /></span><span style="color: #0000BB">?&gt;<br /></span>&lt;form&nbsp;method="post"&gt;<br />&lt;table&gt;<br />&lt;tr&gt;&lt;td&gt;&#1513;&#1501;&nbsp;&#1508;&#1512;&#1496;&#1497;&lt;/td&gt;&lt;td&gt;&lt;input&nbsp;type="text"&nbsp;name="fname"&gt;&lt;/td&gt;&lt;/tr&gt;<br />&lt;tr&gt;&lt;td&gt;&#1505;&#1497;&#1505;&#1502;&#1488;&lt;/td&gt;&lt;td&gt;&lt;input&nbsp;type="password"&nbsp;name="pass"&gt;&lt;/td&gt;&lt;/tr&gt;<br />&lt;tr&gt;&lt;td&gt;&#1488;&#1497;&#1502;&#1493;&#1514;&nbsp;&#1505;&#1497;&#1505;&#1502;&#1488;&lt;/td&gt;&lt;td&gt;&lt;input&nbsp;type="password"&nbsp;name="repass"&gt;&lt;/td&gt;&lt;/tr&gt;<br />&lt;tr&gt;&lt;td&gt;&#1488;&#1497;&nbsp;&#1502;&#1497;&#1497;&#1500;&lt;/td&gt;&lt;td&gt;&lt;input&nbsp;type="text"&nbsp;name="email"&gt;&lt;/td&gt;&lt;/tr&gt;<br />&lt;tr&gt;&lt;td&nbsp;colspan="2"&nbsp;align="center"&gt;&lt;input&nbsp;type="submit"&nbsp;name="sub"&nbsp;value="&#1492;&#1512;&#1513;&#1502;&#1492;"&gt;&lt;/td&gt;&lt;/tr&gt;<br />&lt;/table&gt;<br />&lt;/form&gt;<br /><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">}<br />else<br />{<br /></span><span style="color: #0000BB">$fname&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$_POST</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'fname'</span><span style="color: #007700">&#93;;<br /></span><span style="color: #0000BB">$password&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$_POST</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'pass'</span><span style="color: #007700">&#93;;<br /></span><span style="color: #0000BB">$repassword&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$_POST</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'repass'</span><span style="color: #007700">&#93;;<br /></span><span style="color: #0000BB">$email&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$_POST</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'email'</span><span style="color: #007700">&#93;;<br /></span><span style="color: #0000BB">$date&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">'Y-m-d'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$pass1&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">md5</span><span style="color: #007700">(</span><span style="color: #0000BB">$password</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$pass&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sha1</span><span style="color: #007700">(</span><span style="color: #0000BB">$pass1</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$select&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;`users`&nbsp;WHERE&nbsp;fname='</span><span style="color: #0000BB">$fname</span><span style="color: #DD0000">'"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$cu&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_fetch_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$select</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$select3&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;`admins`&nbsp;WHERE&nbsp;fname='</span><span style="color: #0000BB">$fname</span><span style="color: #DD0000">'"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$cu3&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_fetch_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$select3</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$select2&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_query</span><span style="color: #007700">(</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;`users`&nbsp;WHERE&nbsp;email='</span><span style="color: #0000BB">$email</span><span style="color: #DD0000">'"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$cu2&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_fetch_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$select2</span><span style="color: #007700">);<br /><br />echo&nbsp;</span><span style="color: #DD0000">"&lt;center&gt;"</span><span style="color: #007700">;<br /><br />if(empty(</span><span style="color: #0000BB">$cu</span><span style="color: #007700">)&nbsp;AND&nbsp;empty(</span><span style="color: #0000BB">$cu</span><span style="color: #007700">)&nbsp;AND&nbsp;</span><span style="color: #0000BB">$password&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #0000BB">$repassword</span><span style="color: #007700">)<br />{<br />if&nbsp;(</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">$fname</span><span style="color: #007700">)&nbsp;&lt;&nbsp;</span><span style="color: #0000BB">3&nbsp;</span><span style="color: #007700">OR&nbsp;</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">$fname</span><span style="color: #007700">)&nbsp;&gt;&nbsp;</span><span style="color: #0000BB">12</span><span style="color: #007700">)<br />{<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;font&nbsp;color='darkred'&gt;&lt;b&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&#1513;&#1490;&#1497;&#1488;&#1492;&nbsp;-&nbsp;&#1492;&#1513;&#1501;&nbsp;&#1492;&#1508;&#1512;&#1496;&#1497;&nbsp;&#1513;&#1489;&#1495;&#1512;&#1514;&nbsp;&#1488;&#1512;&#1493;&#1498;/&#1511;&#1510;&#1512;&nbsp;&#1502;&#1491;&#1497;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;/b&gt;&lt;/font&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;br&gt;&lt;br&gt;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;<br /></span>&lt;input&nbsp;type="button"&nbsp;value="&#1495;&#1494;&#1493;&#1512;&nbsp;&#1488;&#1495;&#1493;&#1512;&#1492;"&nbsp;onclick="window.location.href='javascript<b></b>:window.history.back(-1)';"&gt;<br /><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">}<br /><br />else&nbsp;if&nbsp;(</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">$password</span><span style="color: #007700">)&nbsp;&lt;&nbsp;</span><span style="color: #0000BB">3&nbsp;</span><span style="color: #007700">OR&nbsp;</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">$password</span><span style="color: #007700">)&nbsp;&gt;&nbsp;</span><span style="color: #0000BB">12</span><span style="color: #007700">)<br />{<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;font&nbsp;color='darkred'&gt;&lt;b&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&#1513;&#1490;&#1497;&#1488;&#1492;&nbsp;-&nbsp;&#1492;&#1505;&#1497;&#1505;&#1502;&#1488;&nbsp;&#1488;&#1512;&#1493;&#1499;&#1492;/&#1511;&#1510;&#1512;&#1492;&nbsp;&#1502;&#1491;&#1497;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;/b&gt;&lt;/font&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;br&gt;&lt;br&gt;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;<br /></span>&lt;input&nbsp;type="button"&nbsp;value="&#1495;&#1494;&#1493;&#1512;&nbsp;&#1488;&#1495;&#1493;&#1512;&#1492;"&nbsp;onclick="window.location.href='javascript<b></b>:window.history.back(-1)';"&gt;<br /><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">}<br /><br />else&nbsp;if&nbsp;(!empty(</span><span style="color: #0000BB">$cu2</span><span style="color: #007700">))<br />{<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;font&nbsp;color='darkred'&gt;&lt;b&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&#1513;&#1490;&#1497;&#1488;&#1492;&nbsp;-&nbsp;&#1492;&#1488;&#1497;&nbsp;&#1502;&#1497;&#1497;&#1500;&nbsp;&#1514;&#1508;&#1493;&#1505;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;/b&gt;&lt;/font&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;br&gt;&lt;br&gt;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;<br /></span>&lt;input&nbsp;type="button"&nbsp;value="&#1495;&#1494;&#1493;&#1512;&nbsp;&#1488;&#1495;&#1493;&#1512;&#1492;"&nbsp;onclick="window.location.href='javascript<b></b>:window.history.back(-1)';"&gt;<br /><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">}<br /><br />else&nbsp;if&nbsp;(</span><span style="color: #0000BB">stristr</span><span style="color: #007700">(</span><span style="color: #0000BB">$email</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"@"</span><span style="color: #007700">)&nbsp;==&nbsp;</span><span style="color: #0000BB">false&nbsp;</span><span style="color: #007700">OR&nbsp;</span><span style="color: #0000BB">stristr</span><span style="color: #007700">(</span><span style="color: #0000BB">$email</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"."</span><span style="color: #007700">)==&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">)<br />{<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;font&nbsp;color='darkred'&gt;&lt;b&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&#1513;&#1490;&#1497;&#1488;&#1492;&nbsp;-&nbsp;&#1492;&#1488;&#1497;&nbsp;&#1502;&#1497;&#1497;&#1500;&nbsp;&#1500;&#1488;&nbsp;&#1514;&#1511;&#1497;&#1503;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;/b&gt;&lt;/font&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;br&gt;&lt;br&gt;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;<br /></span>&lt;input&nbsp;type="button"&nbsp;value="&#1495;&#1494;&#1493;&#1512;&nbsp;&#1488;&#1495;&#1493;&#1512;&#1492;"&nbsp;onclick="window.location.href='javascript<b></b>:window.history.back(-1)';"&gt;<br /><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">}<br /><br />else<br />{<br /></span><span style="color: #0000BB">$insert&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_query</span><span style="color: #007700">(</span><span style="color: #DD0000">"INSERT&nbsp;INTO&nbsp;`users`&nbsp;VALUES&nbsp;('','</span><span style="color: #0000BB">$fname</span><span style="color: #DD0000">','</span><span style="color: #0000BB">$pass</span><span style="color: #DD0000">','</span><span style="color: #0000BB">$email</span><span style="color: #DD0000">','0','','</span><span style="color: #0000BB">$date</span><span style="color: #DD0000">','0')"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">setcookie</span><span style="color: #007700">(</span><span style="color: #DD0000">'adv_U'</span><span style="color: #007700">,</span><span style="color: #0000BB">$fname</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">setcookie</span><span style="color: #007700">(</span><span style="color: #DD0000">'adv_P'</span><span style="color: #007700">,</span><span style="color: #0000BB">$pass</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">Header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Location:&nbsp;index.php'</span><span style="color: #007700">);<br />}<br />}<br />else&nbsp;if&nbsp;(</span><span style="color: #0000BB">$password&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #0000BB">$repassword</span><span style="color: #007700">)<br />{<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;font&nbsp;color='darkred'&gt;&lt;b&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&#1513;&#1490;&#1497;&#1488;&#1492;&nbsp;-&nbsp;&#1488;&#1497;&#1502;&#1493;&#1514;&nbsp;&#1505;&#1497;&#1505;&#1502;&#1488;&nbsp;&#1513;&#1490;&#1493;&#1497;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;/b&gt;&lt;/font&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;br&gt;&lt;br&gt;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;<br /></span>&lt;input&nbsp;type="button"&nbsp;value="&#1495;&#1494;&#1493;&#1512;&nbsp;&#1488;&#1495;&#1493;&#1512;&#1492;"&nbsp;onclick="window.location.href='javascript<b></b>:window.history.back(-1)';"&gt;<br /><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">}<br />else<br />{<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;font&nbsp;color='darkred'&gt;&lt;b&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&#1513;&#1490;&#1497;&#1488;&#1492;&nbsp;-&nbsp;&#1513;&#1501;&nbsp;&#1508;&#1512;&#1496;&#1497;&nbsp;&#1514;&#1508;&#1493;&#1505;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;/b&gt;&lt;/font&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;br&gt;&lt;br&gt;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;<br /></span>&lt;input&nbsp;type="button"&nbsp;value="&#1495;&#1494;&#1493;&#1512;&nbsp;&#1488;&#1495;&#1493;&#1512;&#1492;"&nbsp;onclick="window.location.href='javascript<b></b>:window.history.back(-1)';"&gt;<br /><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">}<br />}<br /></span><span style="color: #0000BB">?&gt;<br /></span>&lt;/body&gt;<br />&lt;/html&gt;<br /><span style="color: #0000BB">&lt;?php<br />ob_end_flush</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;<br />&lt;?php<br />?&gt;<br /></span>&lt;br&nbsp;/&gt;&nbsp;&lt;br&nbsp;/&gt;&nbsp;&lt;br&nbsp;/&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;include(LOVE_ROOT&nbsp;.&nbsp;'/system/love_foot.php');<br />}<br />else<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;header('Location:&nbsp;modules/'&nbsp;.&nbsp;MODULE);<br />}<br />?&gt;</span>
</code></code><hr />
</div> <br />
<br />
it dirrects me to line number 164, (the last line of the code), and &quot;unexpected $end&quot;...<br />
<br />
????? what is going on here? it's a simple Sign Up code + few php's I added for the overall design and form around...<br />
<br />
please guys, thanks alot!</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>Zyzz</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389983-wtf-unexpected-end-and-I-did-nothin-wrong!</guid>
		</item>
		<item>
			<title><![CDATA[OMG im stuck with "unexpected T_STRING" 3 days already!!!]]></title>
			<link>http://board.phpbuilder.com/showthread.php?10389967-OMG-im-stuck-with-quot-unexpected-T_STRING-quot-3-days-already!!!&amp;goto=newpost</link>
			<pubDate>Wed, 12 Jun 2013 18:51:01 GMT</pubDate>
			<description><![CDATA[Hey guys, im so glad to join this community cuz im so lost!
I tried for the last 3 days to solve this ****in annoying "unexpected T_STRING", and didnt mange to do it!

so I addressed my question to some guy and he tried to help me, but his code didnt work as well.

please try and look at this, im so desperate :(

*_So this is the original code:_*
[signup form that connects the users to the database sql]:


PHP:
---------
<?php/////////////////////////////////////////////////////////////////////////////////
//                                                                             //
//  DO NOT COPY ANYTHING FROM HERE
SITE BY XXXXXXXX                     //
//                                                     //
//                                                                             //
/////////////////////////////////////////////////////////////////////////////////


include('config.php');


if(PAGE == 'none')
{
	include(parts . '/parts/header.php');
	$content = '<h2> Sign Up </h2>
<br />






<?php
ob_start();
?>
<html dir="rtl">
<head>
<title></title>


<meta http-equiv="Content-Type" content="text/html; charset=windows-1255" />
</head>
<body>
<br><br>
<?php


$selcom = mysql_query("SELECT * FROM `com` ORDER BY ID DESC");
$selcom = mysql_fetch_array($selcom);
?>
<center>
<?php
?>
<?php
if(empty($_POST['sub']))
{
?>
<form method="post">
<table>
XXXXXXXXXXXXXXXXXXXXXX
</table>
</form>
<?php
}
else
{
XXXXXXXXXXXXXXXXXXXXXXXXXXXX
}
}
?>
</body>
</html>
<?php
ob_end_flush();
?>
<?php
?>
<br /> <br /> <br /> 	




	include(parts . '/parts/footer.php');
}
else
{
	header('Location: pages/' . PAGE);
}
?>
---------

it's supposed to insert to the page the footer & header php's, for the "design", and to add the form in the middle of the page. this is my goal..

so it's didn't work cuz:

PHP:
---------
Parse error: syntax error, unexpected T_STRING
---------
leads me to:

PHP:
---------
if(empty($_POST['sub'])){
---------
SO what is the problem around here?
I did NOT miss anything, closed everyline as I should to..
I really dont know what to do..

Thanks to the helpers, REALLY BIG THANK YOU!

I don't know why it's so complicated.. it's just a ****in sign up form with few php's around it for the design .. that's all..]]></description>
			<content:encoded><![CDATA[<div>Hey guys, im so glad to join this community cuz im so lost!<br />
I tried for the last 3 days to solve this ****in annoying &quot;unexpected T_STRING&quot;, and didnt mange to do it!<br />
<br />
so I addressed my question to some guy and he tried to help me, but his code didnt work as well.<br />
<br />
please try and look at this, im so desperate :(<br />
<br />
<b><u>So this is the original code:</u></b><br />
[signup form that connects the users to the database sql]:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php</span><span style="color: #FF8000">/////////////////////////////////////////////////////////////////////////////////<br />//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//<br />//&nbsp;&nbsp;DO&nbsp;NOT&nbsp;COPY&nbsp;ANYTHING&nbsp;FROM&nbsp;HERE<br /></span><span style="color: #0000BB">SITE&nbsp;BY&nbsp;XXXXXXXX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//<br />//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//<br />//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//<br />/////////////////////////////////////////////////////////////////////////////////<br /><br /><br /></span><span style="color: #007700">include(</span><span style="color: #DD0000">'config.php'</span><span style="color: #007700">);<br /><br /><br />if(</span><span style="color: #0000BB">PAGE&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #DD0000">'none'</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;include(</span><span style="color: #0000BB">parts&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'/parts/header.php'</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$content&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'&lt;h2&gt;&nbsp;Sign&nbsp;Up&nbsp;&lt;/h2&gt;<br />&lt;br&nbsp;/&gt;<br /><br /><br /><br /><br /><br /><br />&lt;?php<br />ob_start();<br />?&gt;<br />&lt;html&nbsp;dir="rtl"&gt;<br />&lt;head&gt;<br />&lt;title&gt;&lt;/title&gt;<br /><br /><br />&lt;meta&nbsp;http-equiv="Content-Type"&nbsp;content="text/html;&nbsp;charset=windows-1255"&nbsp;/&gt;<br />&lt;/head&gt;<br />&lt;body&gt;<br />&lt;br&gt;&lt;br&gt;<br />&lt;?php<br /><br /><br />$selcom&nbsp;=&nbsp;mysql_query("SELECT&nbsp;*&nbsp;FROM&nbsp;`com`&nbsp;ORDER&nbsp;BY&nbsp;ID&nbsp;DESC");<br />$selcom&nbsp;=&nbsp;mysql_fetch_array($selcom);<br />?&gt;<br />&lt;center&gt;<br />&lt;?php<br />?&gt;<br />&lt;?php<br />if(empty($_POST&#91;'</span><span style="color: #0000BB">sub</span><span style="color: #DD0000">'&#93;))<br />{<br />?&gt;<br />&lt;form&nbsp;method="post"&gt;<br />&lt;table&gt;<br />XXXXXXXXXXXXXXXXXXXXXX<br />&lt;/table&gt;<br />&lt;/form&gt;<br />&lt;?php<br />}<br />else<br />{<br />XXXXXXXXXXXXXXXXXXXXXXXXXXXX<br />}<br />}<br />?&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;<br />&lt;?php<br />ob_end_flush();<br />?&gt;<br />&lt;?php<br />?&gt;<br />&lt;br&nbsp;/&gt;&nbsp;&lt;br&nbsp;/&gt;&nbsp;&lt;br&nbsp;/&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /><br /><br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;include(parts&nbsp;.&nbsp;'</span><span style="color: #007700">/</span><span style="color: #0000BB">parts</span><span style="color: #007700">/</span><span style="color: #0000BB">footer</span><span style="color: #007700">.</span><span style="color: #0000BB">php</span><span style="color: #DD0000">');<br />}<br />else<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;header('</span><span style="color: #0000BB">Location</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">pages</span><span style="color: #007700">/</span><span style="color: #DD0000">'&nbsp;.&nbsp;PAGE);<br />}<br />?&gt;</span>
</span>
</code></code><hr />
</div> <br />
it's supposed to insert to the page the footer &amp; header php's, for the &quot;design&quot;, and to add the form in the middle of the page. this is my goal..<br />
<br />
so it's didn't work cuz:<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB">Parse&nbsp;error</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">syntax&nbsp;error</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">unexpected&nbsp;T_STRING&nbsp;<br /></span>
</span>
</code></code><hr />
</div> leads me to:<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #007700">if(empty(</span><span style="color: #0000BB">$_POST</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'sub'</span><span style="color: #007700">&#93;)){&nbsp;<br /></span><span style="color: #0000BB"></span>
</span>
</code></code><hr />
</div> SO what is the problem around here?<br />
I did NOT miss anything, closed everyline as I should to..<br />
I really dont know what to do..<br />
<br />
Thanks to the helpers, REALLY BIG THANK YOU!<br />
<br />
I don't know why it's so complicated.. it's just a ****in sign up form with few php's around it for the design .. that's all..</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>Zyzz</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389967-OMG-im-stuck-with-quot-unexpected-T_STRING-quot-3-days-already!!!</guid>
		</item>
		<item>
			<title>Coding a Poll</title>
			<link>http://board.phpbuilder.com/showthread.php?10389949-Coding-a-Poll&amp;goto=newpost</link>
			<pubDate>Mon, 10 Jun 2013 18:44:35 GMT</pubDate>
			<description><![CDATA[Hi I am new to this forum and am also new to PHP. I have coded the structure of my website using HTML & CSS. I have started reading books to try and give myself a boost and 
they are extremely useful. I would now like to take a leap forward and code a poll to see peoples views on my website. 

If anyone could give me a detailed tutorial on how to code a poll or link me to another 
website that will teach me I would be greatly thankful.]]></description>
			<content:encoded><![CDATA[<div>Hi I am new to this forum and am also new to PHP. I have coded the structure of my website using HTML &amp; CSS. I have started reading books to try and give myself a boost and <br />
they are extremely useful. I would now like to take a leap forward and code a poll to see peoples views on my website. <br />
<br />
If anyone could give me a detailed tutorial on how to code a poll or link me to another <br />
website that will teach me I would be greatly thankful.</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>HQmaroon</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389949-Coding-a-Poll</guid>
		</item>
		<item>
			<title>Auto-calculate form</title>
			<link>http://board.phpbuilder.com/showthread.php?10389931-Auto-calculate-form&amp;goto=newpost</link>
			<pubDate>Sat, 08 Jun 2013 20:34:24 GMT</pubDate>
			<description><![CDATA[Hello everybody, im new in php programming and have came to a dead end. I have a homework that I must make till Monday  but I dont know how to make it and really need some help.

Im making a simple, like order, form that will take numbers imputed and save it to a simple txt file that acts like database. Now I need to auto calculate price when someone enters amount.

Here is the code for the form, if anybody can help ill really appreciate it. Tyvm and cheers.


HTML:
---------
<form name="form1" method="post" action="order.php">
	<table width="400" border="0" cellspacing="0" cellpadding="4">
		<tr>
			<td>Item</td>
			<td>Amount</td>
			<td>Total sum:</td>
		</tr>
		<tr>
			<td>Gloves (<font color="red">25</font> dollars pair)</td>
			<td><input name="gloves" type="text" id="gloves" size="4"></td>
			<td>
			
				<?PHP 
				$price_gloves=125;
				$tot_gloves=$price_gloves*gloves;
				echo "<p>$tot_gloves dollars</p>";
				?>
				
			</td>
		</tr>
		<tr>
			<td>Kimono (<font color="red">100</font> dollars each)</td>
			<td><input name="kimono" type="text" id="kimono" size="4"></td>
			<td>
			
				<?PHP 
				$price_kimono=125;
				$tot_kimono=$price_kimono*kimono;
				echo "<p>$tot_kimono dollars</p>";
				?>
				
			</td>
		</tr>
		<tr>
			<td>Protectors (<font color="red">15</font> dollars set)</td>
			<td><input name="protectors" type="text" id="protectors" size="4"></td>
			<td>
			
				<?PHP 
				$price_protectors=125;
				$tot_protectors=$price_protectors*protectors;
				echo "<p>$tot_protectors dollars</p>";
				?>
				
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td><input type="submit" name="Submit" value="Submit"></td>
		</tr>
	</table>
</form>
---------
]]></description>
			<content:encoded><![CDATA[<div>Hello everybody, im new in php programming and have came to a dead end. I have a homework that I must make till Monday  but I dont know how to make it and really need some help.<br />
<br />
Im making a simple, like order, form that will take numbers imputed and save it to a simple txt file that acts like database. Now I need to auto calculate price when someone enters amount.<br />
<br />
Here is the code for the form, if anybody can help ill really appreciate it. Tyvm and cheers.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">HTML Code:</div>
	<hr /><code class="bbcode_code"><span style="color:#FF8000">&lt;form name=<span style="color:#0000FF">&quot;form1&quot;</span> method=<span style="color:#0000FF">&quot;post&quot;</span> action=<span style="color:#0000FF">&quot;order.php&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;table width=<span style="color:#0000FF">&quot;400&quot;</span> border=<span style="color:#0000FF">&quot;0&quot;</span> cellspacing=<span style="color:#0000FF">&quot;0&quot;</span> cellpadding=<span style="color:#0000FF">&quot;4&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;tr&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;td&gt;</span>Item<span style="color:#008080">&lt;/td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;td&gt;</span>Amount<span style="color:#008080">&lt;/td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;td&gt;</span>Total sum:<span style="color:#008080">&lt;/td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;/tr&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;tr&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;td&gt;</span>Gloves (<span style="color:#000080">&lt;font color=<span style="color:#0000FF">&quot;red&quot;</span>&gt;</span>25<span style="color:#000080">&lt;/font&gt;</span> dollars pair)<span style="color:#008080">&lt;/td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;td&gt;</span><span style="color:#FF8000">&lt;input name=<span style="color:#0000FF">&quot;gloves&quot;</span> type=<span style="color:#0000FF">&quot;text&quot;</span> id=<span style="color:#0000FF">&quot;gloves&quot;</span> size=<span style="color:#0000FF">&quot;4&quot;</span>&gt;</span><span style="color:#008080">&lt;/td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000080">&lt;?PHP <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $price_gloves=125;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tot_gloves=$price_gloves*gloves;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;&lt;p&gt;$tot_gloves dollars&lt;/p&gt;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;/td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;/tr&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;tr&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;td&gt;</span>Kimono (<span style="color:#000080">&lt;font color=<span style="color:#0000FF">&quot;red&quot;</span>&gt;</span>100<span style="color:#000080">&lt;/font&gt;</span> dollars each)<span style="color:#008080">&lt;/td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;td&gt;</span><span style="color:#FF8000">&lt;input name=<span style="color:#0000FF">&quot;kimono&quot;</span> type=<span style="color:#0000FF">&quot;text&quot;</span> id=<span style="color:#0000FF">&quot;kimono&quot;</span> size=<span style="color:#0000FF">&quot;4&quot;</span>&gt;</span><span style="color:#008080">&lt;/td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000080">&lt;?PHP <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $price_kimono=125;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tot_kimono=$price_kimono*kimono;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;&lt;p&gt;$tot_kimono dollars&lt;/p&gt;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;/td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;/tr&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;tr&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;td&gt;</span>Protectors (<span style="color:#000080">&lt;font color=<span style="color:#0000FF">&quot;red&quot;</span>&gt;</span>15<span style="color:#000080">&lt;/font&gt;</span> dollars set)<span style="color:#008080">&lt;/td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;td&gt;</span><span style="color:#FF8000">&lt;input name=<span style="color:#0000FF">&quot;protectors&quot;</span> type=<span style="color:#0000FF">&quot;text&quot;</span> id=<span style="color:#0000FF">&quot;protectors&quot;</span> size=<span style="color:#0000FF">&quot;4&quot;</span>&gt;</span><span style="color:#008080">&lt;/td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000080">&lt;?PHP <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $price_protectors=125;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tot_protectors=$price_protectors*protectors;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;&lt;p&gt;$tot_protectors dollars&lt;/p&gt;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;/td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;/tr&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;tr&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;td&gt;</span><b><i>&amp;nbsp;</i></b><span style="color:#008080">&lt;/td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;td&gt;</span><span style="color:#FF8000">&lt;input type=<span style="color:#0000FF">&quot;submit&quot;</span> name=<span style="color:#0000FF">&quot;Submit&quot;</span> value=<span style="color:#0000FF">&quot;Submit&quot;</span>&gt;</span><span style="color:#008080">&lt;/td&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;/tr&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080">&lt;/table&gt;</span><br />
<span style="color:#FF8000">&lt;/form&gt;</span></code><hr />
</div> </div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>marioweb</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389931-Auto-calculate-form</guid>
		</item>
		<item>
			<title>PHP Mail Loop While</title>
			<link>http://board.phpbuilder.com/showthread.php?10389909-PHP-Mail-Loop-While&amp;goto=newpost</link>
			<pubDate>Thu, 06 Jun 2013 14:12:23 GMT</pubDate>
			<description><![CDATA[I am trying to loop through each record in my database and send an email to the email address associated with that records Once the email is sent I change a value from email_sent=0 to email_sent=1 so it doesnt get sent more than once.

I am expecting to get record 1 emailed to email 1, record 2 emailed to email 2, and so on until all records are marked complete.

I tried placing the loop in a few different places in the code and ended up getting the correct number of emails. The first email had the correct record 1, the second email started with record 1 and appended record 2, the third email had record 1, appended record 2 and record 3. Each record was marked as email_sent=1.

I also tried just running the query three times within the same page with some changes to try to close the loop but it didnt work either.

The code below is working to send record 1 to email 1, marks the record complete. When run again it sends record 2 to email 2 and marks it complete. I then have to run it once for each record in the database.

I am using LIMIT 1 because if it isn't there I got all records sent in one email.

Here is the code. Any help or thoughts would be greatly appreciated:

Code:
---------
<?php 
require_once("dbconnxyz.php"); 

if (!mysql_connect($DB_HOST, $DB_USER, $DB_PASSWORD)) 
die("Can't connect to database"); 
if (!mysql_select_db($DB_DATABASE)) 
die("Can't select database"); 
?> 
<?php 
$result = mysql_query("SELECT * FROM tbl_test WHERE date_target BETWEEN CURDATE() AND ADDDATE(CURDATE(), INTERVAL 30 DAY) AND rev_status <> 'Complete' AND email_sent = 0 LIMIT 1"); 
if (!result) { 
die("No data"); 
} 
while ($row = mysql_fetch_assoc($result)) 
{ 
$from = "Some Name <email@something.com>"; 
$completerecord = "http://xyz.com/some.php?record_id="; 
$header = "From: ".$from."\r\n"; 
$header .= "Reply-To: ".$from; 
$to = $row['email_to']; 
$subject .= "Some text ".$row['xyz_id']." ".$row['record_type']." Due ".$row['date_target']; 
$record_id = $row['record_id']; 

$emailBody .= "You have some email text here in the body."." 
"." 
XYZ: ".$row['xyz_id']." 
Record Type: ".$row['record_type']." 
Start Date: ".$row['date_start']." 
Target Date: ".$row['date_target']." 
Complete: ".$completerecord.$row['record_id']." \n"; 
} 
{ 
$result = mysql_query("UPDATE tbl_test SET email_sent='1' , email_log_date=date('Y-m-d') WHERE record_id='$record_id'"); 
} 

if (mail($to, $subject, $emailBody, $header)) { 
echo("<p>Message successfully sent! Record '$record_id'.</p>"); 
} else { 
echo("<p>Message delivery failed...</p>"); 
} 
 ?>
---------
]]></description>
			<content:encoded><![CDATA[<div>I am trying to loop through each record in my database and send an email to the email address associated with that records Once the email is sent I change a value from email_sent=0 to email_sent=1 so it doesnt get sent more than once.<br />
<br />
I am expecting to get record 1 emailed to email 1, record 2 emailed to email 2, and so on until all records are marked complete.<br />
<br />
I tried placing the loop in a few different places in the code and ended up getting the correct number of emails. The first email had the correct record 1, the second email started with record 1 and appended record 2, the third email had record 1, appended record 2 and record 3. Each record was marked as email_sent=1.<br />
<br />
I also tried just running the query three times within the same page with some changes to try to close the loop but it didnt work either.<br />
<br />
The code below is working to send record 1 to email 1, marks the record complete. When run again it sends record 2 to email 2 and marks it complete. I then have to run it once for each record in the database.<br />
<br />
I am using LIMIT 1 because if it isn't there I got all records sent in one email.<br />
<br />
Here is the code. Any help or thoughts would be greatly appreciated:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&lt;?php <br />
require_once(&quot;dbconnxyz.php&quot;); <br />
<br />
if (!mysql_connect($DB_HOST, $DB_USER, $DB_PASSWORD)) <br />
die(&quot;Can't connect to database&quot;); <br />
if (!mysql_select_db($DB_DATABASE)) <br />
die(&quot;Can't select database&quot;); <br />
?&gt; <br />
&lt;?php <br />
$result = mysql_query(&quot;SELECT * FROM tbl_test WHERE date_target BETWEEN CURDATE() AND ADDDATE(CURDATE(), INTERVAL 30 DAY) AND rev_status &lt;&gt; 'Complete' AND email_sent = 0 LIMIT 1&quot;); <br />
if (!result) { <br />
die(&quot;No data&quot;); <br />
} <br />
while ($row = mysql_fetch_assoc($result)) <br />
{ <br />
$from = &quot;Some Name &lt;email@something.com&gt;&quot;; <br />
$completerecord = &quot;http://xyz.com/some.php?record_id=&quot;; <br />
$header = &quot;From: &quot;.$from.&quot;\r\n&quot;; <br />
$header .= &quot;Reply-To: &quot;.$from; <br />
$to = $row['email_to']; <br />
$subject .= &quot;Some text &quot;.$row['xyz_id'].&quot; &quot;.$row['record_type'].&quot; Due &quot;.$row['date_target']; <br />
$record_id = $row['record_id']; <br />
<br />
$emailBody .= &quot;You have some email text here in the body.&quot;.&quot; <br />
&quot;.&quot; <br />
XYZ: &quot;.$row['xyz_id'].&quot; <br />
Record Type: &quot;.$row['record_type'].&quot; <br />
Start Date: &quot;.$row['date_start'].&quot; <br />
Target Date: &quot;.$row['date_target'].&quot; <br />
Complete: &quot;.$completerecord.$row['record_id'].&quot; \n&quot;; <br />
} <br />
{ <br />
$result = mysql_query(&quot;UPDATE tbl_test SET email_sent='1' , email_log_date=date('Y-m-d') WHERE record_id='$record_id'&quot;); <br />
} <br />
<br />
if (mail($to, $subject, $emailBody, $header)) { <br />
echo(&quot;&lt;p&gt;Message successfully sent! Record '$record_id'.&lt;/p&gt;&quot;); <br />
} else { <br />
echo(&quot;&lt;p&gt;Message delivery failed...&lt;/p&gt;&quot;); <br />
} <br />
&nbsp;?&gt;</code><hr />
</div> </div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>ThatsBadAss.com</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389909-PHP-Mail-Loop-While</guid>
		</item>
		<item>
			<title>Question on PHP programm?</title>
			<link>http://board.phpbuilder.com/showthread.php?10389895-Question-on-PHP-programm&amp;goto=newpost</link>
			<pubDate>Wed, 05 Jun 2013 08:09:27 GMT</pubDate>
			<description><![CDATA[Hi all,

I'm trying to create a PHP programm that does the following:

Acts as a tracker in a call-center environment, where each agent has to log in to his account and can enter basic data about each case he has (e.g. serial number, calling party etc.). Afterwards, the programm has to check if the serial is in a database (Excel file as of now) and give it's category listing. Then, we have to count them by category/agent/calling party?

How do you suggest this should be done best?

Kind regards,]]></description>
			<content:encoded><![CDATA[<div>Hi all,<br />
<br />
I'm trying to create a PHP programm that does the following:<br />
<br />
Acts as a tracker in a call-center environment, where each agent has to log in to his account and can enter basic data about each case he has (e.g. serial number, calling party etc.). Afterwards, the programm has to check if the serial is in a database (Excel file as of now) and give it's category listing. Then, we have to count them by category/agent/calling party?<br />
<br />
How do you suggest this should be done best?<br />
<br />
Kind regards,</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>Blago86</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389895-Question-on-PHP-programm</guid>
		</item>
		<item>
			<title>CRUD class</title>
			<link>http://board.phpbuilder.com/showthread.php?10389871-CRUD-class&amp;goto=newpost</link>
			<pubDate>Mon, 03 Jun 2013 15:33:45 GMT</pubDate>
			<description><![CDATA[Hello everyone.
This is my first post here. :)
I'm implementing a very simple PHP class (learning purposes only) for doing CRUD tasks and I would love to receive some tips/advices about good practices.
As every CRUD class, this one has a delete() method which is used only to delete an entry from the database (MySQL in my case).
My question is:

For the delete() method, is it good to check if the entries that match the WHERE clause really exist before effectively deleting them?
In other words: before executing the deletion itself, should I include as part of the code for the delete() method the instructions for checking if the entries really exist or this checking should be done *outside* elsewhere (maybe in an isolated method)? Or yet, do you guys think that shouldn't be a concern, since the DBMS doesn't complain (i.e. doesn't emit any errors) when deleting entries that don't exist in the given table?

What is the best option? Which approach the PHP frameworks use for handling this situation?
Thanks a lot for any help! :)]]></description>
			<content:encoded><![CDATA[<div>Hello everyone.<br />
This is my first post here. :)<br />
I'm implementing a very simple PHP class (learning purposes only) for doing CRUD tasks and I would love to receive some tips/advices about good practices.<br />
As every CRUD class, this one has a delete() method which is used only to delete an entry from the database (MySQL in my case).<br />
My question is:<br />
<br />
For the delete() method, is it good to check if the entries that match the WHERE clause really exist before effectively deleting them?<br />
In other words: before executing the deletion itself, should I include as part of the code for the delete() method the instructions for checking if the entries really exist or this checking should be done *outside* elsewhere (maybe in an isolated method)? Or yet, do you guys think that shouldn't be a concern, since the DBMS doesn't complain (i.e. doesn't emit any errors) when deleting entries that don't exist in the given table?<br />
<br />
What is the best option? Which approach the PHP frameworks use for handling this situation?<br />
Thanks a lot for any help! :)</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>chapeupreto</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389871-CRUD-class</guid>
		</item>
		<item>
			<title><![CDATA[[RESOLVED] How to fix "Headers Already Sent"?]]></title>
			<link>http://board.phpbuilder.com/showthread.php?10389861-RESOLVED-How-to-fix-quot-Headers-Already-Sent-quot&amp;goto=newpost</link>
			<pubDate>Fri, 31 May 2013 18:26:25 GMT</pubDate>
			<description><![CDATA[Hi guys n gals;
I'm playing with sessions at the moment and it's a PIA to get my head around.:confused:

I have the following snippet in form.php:


PHP:
---------
<?php
session_start();
// prevent page caching in PHP:
header('Cache-Control: no-cache, no-store, must-revalidate'); //HTTP/1.1
header('Expires: Sun, 01 Jul 2005 00:00:00 GMT');
header('Pragma: no-cache'); //HTTP/1.0

/* if (!session_start()) {
  die("Session failed to start!"); }
*/
?>
---------
I understand the part about headers already sent: The question is, HOW can I combine the two things? And yes I know they're out of order if they did work, but as shown throws only the Headers Already Sent message instead of a bunch of Notices and Warnings. And besides I know the session is working or the first section of code wouldn't work. 

1.  How do I get both parts, including the commented out part, to work?

2.  Why would a session fail to start? That would be a server issue, would it not? Nothing to do with the coder or visitor? LOL, assuming the coder did his job right!

3.  But since I can envision other circumstances where I may want to use two or more, how would I do it?

Sorry for the dumb Q! :o]]></description>
			<content:encoded><![CDATA[<div>Hi guys n gals;<br />
I'm playing with sessions at the moment and it's a PIA to get my head around.:confused:<br />
<br />
I have the following snippet in form.php:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />session_start</span><span style="color: #007700">();<br /></span><span style="color: #FF8000">//&nbsp;prevent&nbsp;page&nbsp;caching&nbsp;in&nbsp;PHP:<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Cache-Control:&nbsp;no-cache,&nbsp;no-store,&nbsp;must-revalidate'</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//HTTP/1.1<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Expires:&nbsp;Sun,&nbsp;01&nbsp;Jul&nbsp;2005&nbsp;00:00:00&nbsp;GMT'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Pragma:&nbsp;no-cache'</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//HTTP/1.0<br /><br />/*&nbsp;if&nbsp;(!session_start())&nbsp;{<br />&nbsp;&nbsp;die("Session&nbsp;failed&nbsp;to&nbsp;start!");&nbsp;}<br />*/<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></code><hr />
</div> I understand the part about headers already sent: The question is, HOW can I combine the two things? And yes I know they're out of order if they did work, but as shown throws only the Headers Already Sent message instead of a bunch of Notices and Warnings. And besides I know the session is working or the first section of code wouldn't work. <br />
<br />
1.  How do I get both parts, including the commented out part, to work?<br />
<br />
2.  Why would a session fail to start? That would be a server issue, would it not? Nothing to do with the coder or visitor? LOL, assuming the coder did his job right!<br />
<br />
3.  But since I can envision other circumstances where I may want to use two or more, how would I do it?<br />
<br />
Sorry for the dumb Q! :o</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>Rivet</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389861-RESOLVED-How-to-fix-quot-Headers-Already-Sent-quot</guid>
		</item>
		<item>
			<title>Extracting Entries From Arrays From My Database</title>
			<link>http://board.phpbuilder.com/showthread.php?10389853-Extracting-Entries-From-Arrays-From-My-Database&amp;goto=newpost</link>
			<pubDate>Fri, 31 May 2013 01:15:29 GMT</pubDate>
			<description><![CDATA[I query a field within my database and when I echo the value from the table entry I get the following:

a:2:{i:0;s:8:"Joe";i:1;s:15:"Jenny";}
a:1:{i:0;s:11:"Jimmy";}
a:1:{i:0;s:8:"Joe";}

Can anyone point me in the right direction to find out what rows a Joe exists in? Sorry I'm a bit of a newb but learning quick.  In this example for instance it would be in row 0 and row 2 but just trying to figure out how to output an array that tells me that.]]></description>
			<content:encoded><![CDATA[<div>I query a field within my database and when I echo the value from the table entry I get the following:<br />
<br />
a:2:{i:0;s:8:&quot;Joe&quot;;i:1;s:15:&quot;Jenny&quot;;}<br />
a:1:{i:0;s:11:&quot;Jimmy&quot;;}<br />
a:1:{i:0;s:8:&quot;Joe&quot;;}<br />
<br />
Can anyone point me in the right direction to find out what rows a Joe exists in? Sorry I'm a bit of a newb but learning quick.  In this example for instance it would be in row 0 and row 2 but just trying to figure out how to output an array that tells me that.</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>jkrystof</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389853-Extracting-Entries-From-Arrays-From-My-Database</guid>
		</item>
		<item>
			<title>Connecting to MySQL</title>
			<link>http://board.phpbuilder.com/showthread.php?10389847-Connecting-to-MySQL&amp;goto=newpost</link>
			<pubDate>Thu, 30 May 2013 21:27:08 GMT</pubDate>
			<description><![CDATA[Hey everyone. I am working on an assignment and need some help. I have no syntax errors but it won't connect to MySQL. My assignment is to do a poll on a fake company that I have set up on the fake company's products....well...take a look at my code and see if there is anything wrong...please!!!  

PHP:
---------
 <?php
		//get vote from form
		$vote=$_REQUEST['vote'];
		
		//log in to database
		if (!$db_conn = new mysqli('localhost', 'poll', 'poll', 'POLL'))
		{
			echo 'Could not connect to database<br/>';
			exit;
		}
		
		if (!empty($vote)) //if they filled the form out, add their vote
		{
			$vote = addslashes($vote);
			$query = "update poll_results
			set num_votes = num_votes + 1
			where SODA_NAME = '$vote'";
		if(!($result = @$db_conn->query($query)))
		{
			echo 'Could not connect to database<br />';
			exit;
		}
		}
		
		//get current results of poll, regardless of whether they voted
		$query = 'select * from poll_results';
		if(!($result = @$db_conn->query($query)))
		{
			echo 'Could not connect to database<br />';
			exit;
		}
		$num_SODA_NAME = $result->num_rows;
		
		//calculate total number of votes so far
		$total_votes=0;
		while ($row = $result->fetch_object())
		{
			$total_votes += $row->num_votes;
		}
		$result->data_seek(0); //reset result pointer
		
		/******************************
		Initial calculations for graph
		*******************************/
		//set up constants
		putenv('GDFONTPATH=/Applications/Font Book.app');
		$width=500;  //width of image in pixel-this will fit in 640x480
		$left_margin = 50; //space to leave on left of graph
		$right_margin = 50; //ditto right
		$bar_height = 40; 
		$bar_spacing = $bar_height/2;
		$font = 'ariel';
		$title_size= 16; //point
		$main_size= 12; //point
		$small_size= 12; //point
		$text_indent = 10; //postition for text labels from edge of image
		
		//set up initial point to draw from
		$x = $left_margin + 60; //place to draw baseline of the graph
		$y = 50; //ditto
		$bar_unit = (width-($x+$right_margin)) / 100; //one "point" on the graph
		
		//calculate height of graph - bars plus gaps plus some margin
		$height = $num_SODA_NAME * ($bar_height + $bar_spacing) + 50;
	
	/******************
	Set up base image
	*******************/
	
	//create a blank canvas
	$im = imagecreateruecolor($width, $height);
	
	//Allocate colors
	$white=imagecolorallocate($im, 255, 255, 255, 255);
	$blue=imagecolorallocate($im, 0, 64, 128);
	$black=imagecolorallocate($im, 0, 0, 0);
	$pink=imagecolorallocate($im, 255, 78, 243);
	
	$text_color = $black;
	$percent_color = $black;
	$bg_color = $white;
	$line_color = $black;
	$bar_color = $blue;
	$number_color = $pink;
	
	//Create "canvas" to draw on
	imagefilledrectangle($im, 0, 0, $width, $height, $bg_color);
	
	//Draw outline around canvas
	imagerectangle($im, 0, 0, $width-1, $height-1, $line_color);
	
	//Add title
	$title = 'The Beverage Company Poll Results';
	$title_dimentions = imagettfbbox($title_size, 0, $font, $title);
	$title_length = $title_dimentions[2] - $title_dimentions[0];
	$title_height = abs($title_dimentions[7] - $title_dimentions[1]);
	$title_above_line = abs($title_dimentions[7]);
	$title_x = ($width-$title_length)/2; //center it in x
	$title_y = ($y - $title_height)/2 + $title_above_line; //center in y gap
	imagettftext($im, $title_size, 0, $title_x, $title_y, 
	$title_color, $font, $title);
	
	//Draw a base line from a little above first bar location
	//to a little below last
	imageline($im, $x, $y-5, $x, $height-15, $line_color);
	
	/********************
	Draw data into graph
	*********************/
	
	//Get each line of db data and draw corresponding bars
	while ($row = $result->fetch_object())
	{
		if($total_votes > 0)
			$percent = intval(($row->num_votes/$total_votes)*100);
		else
			$percent = 0;
			
			//display percent for this value
		$percent_dimentions = imagettfbbox($main_size, 0, $font, $percent.'%');
		$percent_length = $percent_dimentions[2] - $percent_dimentions[0];
		imagettftext($im, $main_size, 0, $width-$percent_length-$text_indent,
		$y+($bar_height/2), $percent_color, $font, $percent.'%');
		
		//length of bar for this value
		$bar_length = $x + ($percent * $bar_unit);
		
		//draw bar for this value
		imagefilledrectangle($im, $x, $y-2, $bar_length, $y+bar_height, $bar_color);
		
		//draw title for this value
		imagettftext($im, $main_size, 0, $text_indent, $y+($bar_height/2),
		$text_color, $font, "$row->SODA_NAME");
		
		//draw outline showing 100%
		imagerectangle($im, $bar_length+1, $y-2,
		($x+(100*$bar_unit)), $y+$bar_height, $line_color);
		
		//display numbers
		imagettftext($im, $small_size, 0, $x+(100*$bar_unit)-50, $y+($bar_height/2),
		$number_color, $font, $row->num_votes.'/' .$total_votes);
		
		//move down to next bar
		$y=$y+($bar_height+$bar_spacing);
	}
	
	/*************
	Display image
	**************/
	Header('Content-type: image/png');
	imagepng($im);
	
	/*****************
	Clean up
	******************/
	imagedestroy($im);
		
	?>
---------

I appreciate any help. I am wondering if I have to do something in MySQL or Dreamweaver to connect PHP with MySQL that I have missed???  
Thanks,
Beth]]></description>
			<content:encoded><![CDATA[<div>Hey everyone. I am working on an assignment and need some help. I have no syntax errors but it won't connect to MySQL. My assignment is to do a poll on a fake company that I have set up on the fake company's products....well...take a look at my code and see if there is anything wrong...please!!!  <br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
&nbsp;<span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//get&nbsp;vote&nbsp;from&nbsp;form<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$vote</span><span style="color: #007700">=</span><span style="color: #0000BB">$_REQUEST</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'vote'</span><span style="color: #007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//log&nbsp;in&nbsp;to&nbsp;database<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(!</span><span style="color: #0000BB">$db_conn&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">mysqli</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'poll'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'poll'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'POLL'</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Could&nbsp;not&nbsp;connect&nbsp;to&nbsp;database&lt;br/&gt;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!empty(</span><span style="color: #0000BB">$vote</span><span style="color: #007700">))&nbsp;</span><span style="color: #FF8000">//if&nbsp;they&nbsp;filled&nbsp;the&nbsp;form&nbsp;out,&nbsp;add&nbsp;their&nbsp;vote<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$vote&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">addslashes</span><span style="color: #007700">(</span><span style="color: #0000BB">$vote</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$query&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"update&nbsp;poll_results<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set&nbsp;num_votes&nbsp;=&nbsp;num_votes&nbsp;+&nbsp;1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;where&nbsp;SODA_NAME&nbsp;=&nbsp;'</span><span style="color: #0000BB">$vote</span><span style="color: #DD0000">'"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!(</span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;@</span><span style="color: #0000BB">$db_conn</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #0000BB">$query</span><span style="color: #007700">)))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Could&nbsp;not&nbsp;connect&nbsp;to&nbsp;database&lt;br&nbsp;/&gt;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//get&nbsp;current&nbsp;results&nbsp;of&nbsp;poll,&nbsp;regardless&nbsp;of&nbsp;whether&nbsp;they&nbsp;voted<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$query&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'select&nbsp;*&nbsp;from&nbsp;poll_results'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!(</span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;@</span><span style="color: #0000BB">$db_conn</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">query</span><span style="color: #007700">(</span><span style="color: #0000BB">$query</span><span style="color: #007700">)))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Could&nbsp;not&nbsp;connect&nbsp;to&nbsp;database&lt;br&nbsp;/&gt;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$num_SODA_NAME&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_rows</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//calculate&nbsp;total&nbsp;number&nbsp;of&nbsp;votes&nbsp;so&nbsp;far<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$total_votes</span><span style="color: #007700">=</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(</span><span style="color: #0000BB">$row&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">fetch_object</span><span style="color: #007700">())<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$total_votes&nbsp;</span><span style="color: #007700">+=&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_votes</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">data_seek</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//reset&nbsp;result&nbsp;pointer<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/******************************<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Initial&nbsp;calculations&nbsp;for&nbsp;graph<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*******************************/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//set&nbsp;up&nbsp;constants<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">putenv</span><span style="color: #007700">(</span><span style="color: #DD0000">'GDFONTPATH=/Applications/Font&nbsp;Book.app'</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$width</span><span style="color: #007700">=</span><span style="color: #0000BB">500</span><span style="color: #007700">;&nbsp;&nbsp;</span><span style="color: #FF8000">//width&nbsp;of&nbsp;image&nbsp;in&nbsp;pixel-this&nbsp;will&nbsp;fit&nbsp;in&nbsp;640x480<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$left_margin&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">50</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//space&nbsp;to&nbsp;leave&nbsp;on&nbsp;left&nbsp;of&nbsp;graph<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$right_margin&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">50</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//ditto&nbsp;right<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$bar_height&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">40</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$bar_spacing&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$bar_height</span><span style="color: #007700">/</span><span style="color: #0000BB">2</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$font&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'ariel'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$title_size</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">16</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//point<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$main_size</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">12</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//point<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$small_size</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">12</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//point<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$text_indent&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">10</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//postition&nbsp;for&nbsp;text&nbsp;labels&nbsp;from&nbsp;edge&nbsp;of&nbsp;image<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//set&nbsp;up&nbsp;initial&nbsp;point&nbsp;to&nbsp;draw&nbsp;from<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$x&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$left_margin&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">60</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//place&nbsp;to&nbsp;draw&nbsp;baseline&nbsp;of&nbsp;the&nbsp;graph<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$y&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">50</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//ditto<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$bar_unit&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #0000BB">width</span><span style="color: #007700">-(</span><span style="color: #0000BB">$x</span><span style="color: #007700">+</span><span style="color: #0000BB">$right_margin</span><span style="color: #007700">))&nbsp;/&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//one&nbsp;"point"&nbsp;on&nbsp;the&nbsp;graph<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//calculate&nbsp;height&nbsp;of&nbsp;graph&nbsp;-&nbsp;bars&nbsp;plus&nbsp;gaps&nbsp;plus&nbsp;some&nbsp;margin<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$height&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$num_SODA_NAME&nbsp;</span><span style="color: #007700">*&nbsp;(</span><span style="color: #0000BB">$bar_height&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">$bar_spacing</span><span style="color: #007700">)&nbsp;+&nbsp;</span><span style="color: #0000BB">50</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/******************<br />&nbsp;&nbsp;&nbsp;&nbsp;Set&nbsp;up&nbsp;base&nbsp;image<br />&nbsp;&nbsp;&nbsp;&nbsp;*******************/<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;//create&nbsp;a&nbsp;blank&nbsp;canvas<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$im&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecreateruecolor</span><span style="color: #007700">(</span><span style="color: #0000BB">$width</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$height</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//Allocate&nbsp;colors<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$white</span><span style="color: #007700">=</span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">255</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">255</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">255</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">255</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$blue</span><span style="color: #007700">=</span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">64</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">128</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$black</span><span style="color: #007700">=</span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$pink</span><span style="color: #007700">=</span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">255</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">78</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">243</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$text_color&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$black</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$percent_color&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$black</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$bg_color&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$white</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$line_color&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$black</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$bar_color&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$blue</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$number_color&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$pink</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//Create&nbsp;"canvas"&nbsp;to&nbsp;draw&nbsp;on<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">imagefilledrectangle</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$width</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$height</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$bg_color</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//Draw&nbsp;outline&nbsp;around&nbsp;canvas<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">imagerectangle</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$width</span><span style="color: #007700">-</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$height</span><span style="color: #007700">-</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$line_color</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//Add&nbsp;title<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$title&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'The&nbsp;Beverage&nbsp;Company&nbsp;Poll&nbsp;Results'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$title_dimentions&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagettfbbox</span><span style="color: #007700">(</span><span style="color: #0000BB">$title_size</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$font</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$title</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$title_length&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$title_dimentions</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">2</span><span style="color: #007700">&#93;&nbsp;-&nbsp;</span><span style="color: #0000BB">$title_dimentions</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">0</span><span style="color: #007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$title_height&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">abs</span><span style="color: #007700">(</span><span style="color: #0000BB">$title_dimentions</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">7</span><span style="color: #007700">&#93;&nbsp;-&nbsp;</span><span style="color: #0000BB">$title_dimentions</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">1</span><span style="color: #007700">&#93;);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$title_above_line&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">abs</span><span style="color: #007700">(</span><span style="color: #0000BB">$title_dimentions</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">7</span><span style="color: #007700">&#93;);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$title_x&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #0000BB">$width</span><span style="color: #007700">-</span><span style="color: #0000BB">$title_length</span><span style="color: #007700">)/</span><span style="color: #0000BB">2</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//center&nbsp;it&nbsp;in&nbsp;x<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$title_y&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #0000BB">$y&nbsp;</span><span style="color: #007700">-&nbsp;</span><span style="color: #0000BB">$title_height</span><span style="color: #007700">)/</span><span style="color: #0000BB">2&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">$title_above_line</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//center&nbsp;in&nbsp;y&nbsp;gap<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">imagettftext</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$title_size</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$title_x</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$title_y</span><span style="color: #007700">,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$title_color</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$font</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$title</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//Draw&nbsp;a&nbsp;base&nbsp;line&nbsp;from&nbsp;a&nbsp;little&nbsp;above&nbsp;first&nbsp;bar&nbsp;location<br />&nbsp;&nbsp;&nbsp;&nbsp;//to&nbsp;a&nbsp;little&nbsp;below&nbsp;last<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">imageline</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$x</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$y</span><span style="color: #007700">-</span><span style="color: #0000BB">5</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$x</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$height</span><span style="color: #007700">-</span><span style="color: #0000BB">15</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$line_color</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/********************<br />&nbsp;&nbsp;&nbsp;&nbsp;Draw&nbsp;data&nbsp;into&nbsp;graph<br />&nbsp;&nbsp;&nbsp;&nbsp;*********************/<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;//Get&nbsp;each&nbsp;line&nbsp;of&nbsp;db&nbsp;data&nbsp;and&nbsp;draw&nbsp;corresponding&nbsp;bars<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">while&nbsp;(</span><span style="color: #0000BB">$row&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">fetch_object</span><span style="color: #007700">())<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(</span><span style="color: #0000BB">$total_votes&nbsp;</span><span style="color: #007700">&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$percent&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">intval</span><span style="color: #007700">((</span><span style="color: #0000BB">$row</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_votes</span><span style="color: #007700">/</span><span style="color: #0000BB">$total_votes</span><span style="color: #007700">)*</span><span style="color: #0000BB">100</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$percent&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//display&nbsp;percent&nbsp;for&nbsp;this&nbsp;value<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$percent_dimentions&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagettfbbox</span><span style="color: #007700">(</span><span style="color: #0000BB">$main_size</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$font</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$percent</span><span style="color: #007700">.</span><span style="color: #DD0000">'%'</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$percent_length&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$percent_dimentions</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">2</span><span style="color: #007700">&#93;&nbsp;-&nbsp;</span><span style="color: #0000BB">$percent_dimentions</span><span style="color: #007700">&#91;</span><span style="color: #0000BB">0</span><span style="color: #007700">&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">imagettftext</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$main_size</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$width</span><span style="color: #007700">-</span><span style="color: #0000BB">$percent_length</span><span style="color: #007700">-</span><span style="color: #0000BB">$text_indent</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$y</span><span style="color: #007700">+(</span><span style="color: #0000BB">$bar_height</span><span style="color: #007700">/</span><span style="color: #0000BB">2</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">$percent_color</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$font</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$percent</span><span style="color: #007700">.</span><span style="color: #DD0000">'%'</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//length&nbsp;of&nbsp;bar&nbsp;for&nbsp;this&nbsp;value<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$bar_length&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$x&nbsp;</span><span style="color: #007700">+&nbsp;(</span><span style="color: #0000BB">$percent&nbsp;</span><span style="color: #007700">*&nbsp;</span><span style="color: #0000BB">$bar_unit</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//draw&nbsp;bar&nbsp;for&nbsp;this&nbsp;value<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">imagefilledrectangle</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$x</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$y</span><span style="color: #007700">-</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$bar_length</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$y</span><span style="color: #007700">+</span><span style="color: #0000BB">bar_height</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$bar_color</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//draw&nbsp;title&nbsp;for&nbsp;this&nbsp;value<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">imagettftext</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$main_size</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$text_indent</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$y</span><span style="color: #007700">+(</span><span style="color: #0000BB">$bar_height</span><span style="color: #007700">/</span><span style="color: #0000BB">2</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$text_color</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$font</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$row</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">SODA_NAME</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//draw&nbsp;outline&nbsp;showing&nbsp;100%<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">imagerectangle</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$bar_length</span><span style="color: #007700">+</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$y</span><span style="color: #007700">-</span><span style="color: #0000BB">2</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(</span><span style="color: #0000BB">$x</span><span style="color: #007700">+(</span><span style="color: #0000BB">100</span><span style="color: #007700">*</span><span style="color: #0000BB">$bar_unit</span><span style="color: #007700">)),&nbsp;</span><span style="color: #0000BB">$y</span><span style="color: #007700">+</span><span style="color: #0000BB">$bar_height</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$line_color</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//display&nbsp;numbers<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">imagettftext</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$small_size</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$x</span><span style="color: #007700">+(</span><span style="color: #0000BB">100</span><span style="color: #007700">*</span><span style="color: #0000BB">$bar_unit</span><span style="color: #007700">)-</span><span style="color: #0000BB">50</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$y</span><span style="color: #007700">+(</span><span style="color: #0000BB">$bar_height</span><span style="color: #007700">/</span><span style="color: #0000BB">2</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$number_color</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$font</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">num_votes</span><span style="color: #007700">.</span><span style="color: #DD0000">'/'&nbsp;</span><span style="color: #007700">.</span><span style="color: #0000BB">$total_votes</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//move&nbsp;down&nbsp;to&nbsp;next&nbsp;bar<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$y</span><span style="color: #007700">=</span><span style="color: #0000BB">$y</span><span style="color: #007700">+(</span><span style="color: #0000BB">$bar_height</span><span style="color: #007700">+</span><span style="color: #0000BB">$bar_spacing</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*************<br />&nbsp;&nbsp;&nbsp;&nbsp;Display&nbsp;image<br />&nbsp;&nbsp;&nbsp;&nbsp;**************/<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">Header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-type:&nbsp;image/png'</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">imagepng</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*****************<br />&nbsp;&nbsp;&nbsp;&nbsp;Clean&nbsp;up<br />&nbsp;&nbsp;&nbsp;&nbsp;******************/<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">imagedestroy</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">?&gt;</span>
</span>
</code></code><hr />
</div> <br />
I appreciate any help. I am wondering if I have to do something in MySQL or Dreamweaver to connect PHP with MySQL that I have missed???  <br />
Thanks,<br />
Beth</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>Wefferiscoding</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389847-Connecting-to-MySQL</guid>
		</item>
		<item>
			<title><![CDATA[[RESOLVED] SESSION Varuables, saving & retrieving]]></title>
			<link>http://board.phpbuilder.com/showthread.php?10389831-RESOLVED-SESSION-Varuables-saving-amp-retrieving&amp;goto=newpost</link>
			<pubDate>Wed, 29 May 2013 16:13:53 GMT</pubDate>
			<description><![CDATA[PHP 5.3, Win 7, XAMP 1.7.3 local server, + a website with PHP 5.4 served.
3 forms: form.php, formcheck.php and thanks.html.  Code is below.

I guess my methodology might be best to start witn in case it's all wrong. :confused:

It's always seemed logical to get the security issues with access taken care of first, rather than on a 2nd or 3rd page. To that end, I'd like to put the initial security issues right up front onf the form.php just above the actual form input data.

On form.php:
First I create a random number using mt_rand and have the user type it into an input box, type=text, etc. which I assign to $d and follow it with the remaining inputs needed. No problem, all $_POST info echoes fine in formcheck.php. 

Problem: Validating the random code. 
In formcheck.php I have what the user entered as the code. BUT I cannot get at the 'code', OR the $d I assigned it to. 
   In other words, I have what the user eneterd, but I cannot get at the original random number to compare it to for validation. So I can't check if the 'code'  the user entered and th eoriginal random number are the same!

Since I canot get at the original code from a POST, I decided to try using SESSION()s. 

Here are the two pages' codes; minimized for my own clarity and TSing.

So I end up with 2 questions:
1.  Is SESSION a reasonable way to get the info to other pages? Or is there an easier way?
   All the sample code I've been able to find brings this question up:
2. In formcheck.php, WHERE can the $_SESSION[... be located in a script?
   All the examples show it coming immediately after the session_start() but that feels like asking for something that hasn't existed yet. But a session, which any page could access, sounds like the answer but of course it won't work for me!:( I get an undefined index error in formcheck.php. 

Here are the codes:


PHP:
---------
 form.php

<?php
session_start();
$_session['key']='code';
?>
<!DOCTYPE html>
<head>
<title> Contact Form</title>
</head>
<body>
<html>
<?php
echo "<H1> Contact Form </H1>";
   $a= mt_rand(nnn,nnn);
   $b= mt_rand(nnn,nnn);
   $c= mt_rand(nnnnn);
   $d=($a.$b.$c);
   echo "Your Temporary Code is : " . $d."<br />" ;
?>
<form action="formcheck.php" method="post">
<p> Enter your temporary code here : </b> <input type="text" name="code" size="14 "  maxlength="12">  ,including dashes. <br />
<p> Enter Your Name :  <input type="text" name="name" length="20" maxlength="25" value="Tom Rivet" <br /> </p>
<p> Your E-mail Address : <input type="text" name="email" size="30" maxlength="40" value="nobody@spamcop.net" <br />
<p> <input type="submit" value="Send "> </p>
</form>
</body>
</html>
---------
and

PHP:
---------
 formecheck.php:

<?php
session_start();
/* Set e-mail recipient */
$myemail  = "nobody@kspamcop.net";
echo "<br />"."My E-mail: ".$myemail."<br />";
echo "======================="."<br />";

$code=($_POST['code']);
echo "Your temporary code was: ".$code."<br />";
echo "======================="."<br />";

// Verify the code is correct:
  // use session?  Can't get sessions to work

$name=($_POST['name']);
echo "Your Name is: ".$name."<br />";
if (count(explode(' ', $name)) >2) {
  echo "You used too many names-use 1 or 2 names only."."<br />"."Go back and try again"."<br />";
}
echo (strlen($name)-1)." letters<br />";

echo "======================="."<br />";

 echo "Server IP is: " . $_SERVER['REMOTE_ADDR'];
echo "<br />"."======================="."<br />";
?>
---------
An earlier question just occurred to me:
3. Is there a way to get the random number $d into a $_POST to use? 



TIA,

Rivet`]]></description>
			<content:encoded><![CDATA[<div>PHP 5.3, Win 7, XAMP 1.7.3 local server, + a website with PHP 5.4 served.<br />
3 forms: form.php, formcheck.php and thanks.html.  Code is below.<br />
<br />
I guess my methodology might be best to start witn in case it's all wrong. :confused:<br />
<br />
It's always seemed logical to get the security issues with access taken care of first, rather than on a 2nd or 3rd page. To that end, I'd like to put the initial security issues right up front onf the form.php just above the actual form input data.<br />
<br />
On form.php:<br />
First I create a random number using mt_rand and have the user type it into an input box, type=text, etc. which I assign to $d and follow it with the remaining inputs needed. No problem, all $_POST info echoes fine in formcheck.php. <br />
<br />
Problem: Validating the random code. <br />
In formcheck.php I have what the user entered as the code. BUT I cannot get at the 'code', OR the $d I assigned it to. <br />
   In other words, I have what the user eneterd, but I cannot get at the original random number to compare it to for validation. So I can't check if the 'code'  the user entered and th eoriginal random number are the same!<br />
<br />
Since I canot get at the original code from a POST, I decided to try using SESSION()s. <br />
<br />
Here are the two pages' codes; minimized for my own clarity and TSing.<br />
<br />
So I end up with 2 questions:<br />
1.  Is SESSION a reasonable way to get the info to other pages? Or is there an easier way?<br />
   All the sample code I've been able to find brings this question up:<br />
2. In formcheck.php, WHERE can the $_SESSION[... be located in a script?<br />
   All the examples show it coming immediately after the session_start() but that feels like asking for something that hasn't existed yet. But a session, which any page could access, sounds like the answer but of course it won't work for me!:( I get an undefined index error in formcheck.php. <br />
<br />
Here are the codes:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
&nbsp;form.php<br /><br /><span style="color: #0000BB">&lt;?php<br />session_start</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$_session</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'key'</span><span style="color: #007700">&#93;=</span><span style="color: #DD0000">'code'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;<br /></span>&lt;!DOCTYPE&nbsp;html&gt;<br />&lt;head&gt;<br />&lt;title&gt;&nbsp;Contact&nbsp;Form&lt;/title&gt;<br />&lt;/head&gt;<br />&lt;body&gt;<br />&lt;html&gt;<br /><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"&lt;H1&gt;&nbsp;Contact&nbsp;Form&nbsp;&lt;/H1&gt;"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$a</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mt_rand</span><span style="color: #007700">(</span><span style="color: #0000BB">nnn</span><span style="color: #007700">,</span><span style="color: #0000BB">nnn</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mt_rand</span><span style="color: #007700">(</span><span style="color: #0000BB">nnn</span><span style="color: #007700">,</span><span style="color: #0000BB">nnn</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mt_rand</span><span style="color: #007700">(</span><span style="color: #0000BB">nnnnn</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$d</span><span style="color: #007700">=(</span><span style="color: #0000BB">$a</span><span style="color: #007700">.</span><span style="color: #0000BB">$b</span><span style="color: #007700">.</span><span style="color: #0000BB">$c</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Your&nbsp;Temporary&nbsp;Code&nbsp;is&nbsp;:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$d</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;"&nbsp;</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;<br /></span>&lt;form&nbsp;action="formcheck.php"&nbsp;method="post"&gt;<br />&lt;p&gt;&nbsp;Enter&nbsp;your&nbsp;temporary&nbsp;code&nbsp;here&nbsp;:&nbsp;&lt;/b&gt;&nbsp;&lt;input&nbsp;type="text"&nbsp;name="code"&nbsp;size="14&nbsp;"&nbsp;&nbsp;maxlength="12"&gt;&nbsp;&nbsp;,including&nbsp;dashes.&nbsp;&lt;br&nbsp;/&gt;<br />&lt;p&gt;&nbsp;Enter&nbsp;Your&nbsp;Name&nbsp;:&nbsp;&nbsp;&lt;input&nbsp;type="text"&nbsp;name="name"&nbsp;length="20"&nbsp;maxlength="25"&nbsp;value="Tom&nbsp;Rivet"&nbsp;&lt;br&nbsp;/&gt;&nbsp;&lt;/p&gt;<br />&lt;p&gt;&nbsp;Your&nbsp;E-mail&nbsp;Address&nbsp;:&nbsp;&lt;input&nbsp;type="text"&nbsp;name="email"&nbsp;size="30"&nbsp;maxlength="40"&nbsp;value="nobody@spamcop.net"&nbsp;&lt;br&nbsp;/&gt;<br />&lt;p&gt;&nbsp;&lt;input&nbsp;type="submit"&nbsp;value="Send&nbsp;"&gt;&nbsp;&lt;/p&gt;<br />&lt;/form&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;</span>
</code></code><hr />
</div> and<br />
<div class="bbcode_container">
	<div class="bbcode_description">PHP Code:</div>
	<hr /><code class="bbcode_code"><code><span style="color: #000000">
&nbsp;formecheck.php:<br /><br /><span style="color: #0000BB">&lt;?php<br />session_start</span><span style="color: #007700">();<br /></span><span style="color: #FF8000">/*&nbsp;Set&nbsp;e-mail&nbsp;recipient&nbsp;*/<br /></span><span style="color: #0000BB">$myemail&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"nobody@kspamcop.net"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;"</span><span style="color: #007700">.</span><span style="color: #DD0000">"My&nbsp;E-mail:&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">$myemail</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"======================="</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$code</span><span style="color: #007700">=(</span><span style="color: #0000BB">$_POST</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'code'</span><span style="color: #007700">&#93;);<br />echo&nbsp;</span><span style="color: #DD0000">"Your&nbsp;temporary&nbsp;code&nbsp;was:&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">$code</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #DD0000">"======================="</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;Verify&nbsp;the&nbsp;code&nbsp;is&nbsp;correct:<br />&nbsp;&nbsp;//&nbsp;use&nbsp;session?&nbsp;&nbsp;Can't&nbsp;get&nbsp;sessions&nbsp;to&nbsp;work<br /><br /></span><span style="color: #0000BB">$name</span><span style="color: #007700">=(</span><span style="color: #0000BB">$_POST</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'name'</span><span style="color: #007700">&#93;);<br />echo&nbsp;</span><span style="color: #DD0000">"Your&nbsp;Name&nbsp;is:&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">$name</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;"</span><span style="color: #007700">;<br />if&nbsp;(</span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #0000BB">explode</span><span style="color: #007700">(</span><span style="color: #DD0000">'&nbsp;'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$name</span><span style="color: #007700">))&nbsp;&gt;</span><span style="color: #0000BB">2</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"You&nbsp;used&nbsp;too&nbsp;many&nbsp;names-use&nbsp;1&nbsp;or&nbsp;2&nbsp;names&nbsp;only."</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;"</span><span style="color: #007700">.</span><span style="color: #DD0000">"Go&nbsp;back&nbsp;and&nbsp;try&nbsp;again"</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;"</span><span style="color: #007700">;<br />}<br />echo&nbsp;(</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">$name</span><span style="color: #007700">)-</span><span style="color: #0000BB">1</span><span style="color: #007700">).</span><span style="color: #DD0000">"&nbsp;letters&lt;br&nbsp;/&gt;"</span><span style="color: #007700">;<br /><br />echo&nbsp;</span><span style="color: #DD0000">"======================="</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;"</span><span style="color: #007700">;<br /><br />&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Server&nbsp;IP&nbsp;is:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$_SERVER</span><span style="color: #007700">&#91;</span><span style="color: #DD0000">'REMOTE_ADDR'</span><span style="color: #007700">&#93;;<br />echo&nbsp;</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;"</span><span style="color: #007700">.</span><span style="color: #DD0000">"======================="</span><span style="color: #007700">.</span><span style="color: #DD0000">"&lt;br&nbsp;/&gt;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></code><hr />
</div> An earlier question just occurred to me:<br />
3. Is there a way to get the random number $d into a $_POST to use? <br />
<br />
<br />
<br />
TIA,<br />
<br />
Rivet`</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>Rivet</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389831-RESOLVED-SESSION-Varuables-saving-amp-retrieving</guid>
		</item>
		<item>
			<title><![CDATA[[RESOLVED] HTML in PHP & !Doctype]]></title>
			<link>http://board.phpbuilder.com/showthread.php?10389819-RESOLVED-HTML-in-PHP-amp-!Doctype&amp;goto=newpost</link>
			<pubDate>Mon, 27 May 2013 17:41:21 GMT</pubDate>
			<description><![CDATA[I am no guru, but I can generally hold my own in HTML.  A !doctype is pretty important to use in HTML and it seems the same situation should apply to HTML within a PHP script.  
   Howerver, I often see in PHP code snippets simply:
==========
<html>
<body>
...
</body>
</html>
but no !doctype.
==========

1. Without a !doctype how does a server know what type of HTML to serve? Or does it not matter somehow?

2.  Or perhaps is the doctype only needed once the first time it's used? 

I've looked at the Manual and at W3schools plus Google without finding it mentioned.

TIA,

Rivet]]></description>
			<content:encoded><![CDATA[<div>I am no guru, but I can generally hold my own in HTML.  A !doctype is pretty important to use in HTML and it seems the same situation should apply to HTML within a PHP script.  <br />
   Howerver, I often see in PHP code snippets simply:<br />
==========<br />
&lt;html&gt;<br />
&lt;body&gt;<br />
...<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
but no !doctype.<br />
==========<br />
<br />
1. Without a !doctype how does a server know what type of HTML to serve? Or does it not matter somehow?<br />
<br />
2.  Or perhaps is the doctype only needed once the first time it's used? <br />
<br />
I've looked at the Manual and at W3schools plus Google without finding it mentioned.<br />
<br />
TIA,<br />
<br />
Rivet</div>

 ]]></content:encoded>
			<category domain="http://board.phpbuilder.com/forumdisplay.php?3-Newbies">Newbies</category>
			<dc:creator>Rivet</dc:creator>
			<guid isPermaLink="true">http://board.phpbuilder.com/showthread.php?10389819-RESOLVED-HTML-in-PHP-amp-!Doctype</guid>
		</item>
	</channel>
</rss>
