Hmmm, still not sure what is going one because i have created a multipart/form-data
form and posted to it no problem.
So here is my complete code:
<html>
<body>
<?php
/* VARIABLES */
$false=0; //FALSE
$true=1; //TRUE
$temp=-1; //temp
/* CONNECT TO DATABASE */
$host="xxxx";
$uname="xxxx";
$pass="xxxx";
$database="xxxx";
$tablename="xxxx";
$connection= mysql_connect($host,$uname,$pass);
if(!$connection)
{
die("Database connection failed ! <br>");
}
else
{
echo "logged into MySQL Server ", $host, " successfully.<br>";
}
$result=mysql_select_db($database);
if (!$result)
{
die("Database could not be selected");
}
else
{
echo "Database ", $database, " ready to be used.<br><br>";
}
/* USER clicked remove button */
if($_POST['submit'])
{
/* User did NOT eneter a job id */
if(!$jobid)
{
printf("you must enter a valid job id number from the database cletus!");
}
/*user entered a job id number */
else
{
$query="SELECT jobid FROM mark";
$result=mysql_query($query);
while ($row = mysql_fetch_object($result))
{
if($row->jobid == $jobid)
{
$temp=$true;
}
}//while
/* MAIN LOOP */
if($temp == $true){
printf("Job ID valid.");
/* MARKS ESL JOB BOARD */
if($marks)
{
printf("You checked MARKS ESL\n");
/* Retrieve data from DB */
$query="SELECT * FROM mark WHERE jobid = $jobid";
$result=mysql_query($query);
printf("Job Preview:");
echo "<br>--------------------------------<br>";
$id=mysql_result($result,$i,"jobid");
$name=mysql_result($result,$i,"company");
$email=mysql_result($result,$i,"email");
$location=mysql_result($result, $i, "location");
$desc=mysql_result($result,$i,"description");
$url=mysql_result($result,$i, "url");
echo "<br>$id<br>$name<br>$email<br>$location<br>$desc<br>$url<br>";
/* Post data to website */
$ch = curl_init();
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_URL, "http://www.eslteachersboard.com/cgi-bin/esljobs/index.pl?post");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "name=$name&email=$email&subject=$location&body=$desc&url=$url");
curl_exec ($ch);
curl_close ($ch);
echo"<br> Completed CURL <br><br>";
//print_r($HTTP_POST_VARS);
/* Print report/email report */
}
if(!$marks)
{
printf("You didn't check any websites to submit to cletus!");
}
}//if ($temp == true)
}//else
}//submit
/*User clicked preview before removal */
else if ($_POST['preview']){
/* User did NOT eneter a job id */
if(!$jobid)
{
printf("you must enter a valid job id number from the database cletus!");
}
/*user entered a job id number */
else
{
$query="SELECT * FROM mark WHERE jobid = $jobid";
$result=mysql_query($query);
while ($row = mysql_fetch_row($result))
{
if($row[0] = $jobid)
{
$temp=$true;
}
}//while
if($temp == $true){
printf("Job Preview:");
echo "<br>--------------------------------<br>";
$id=mysql_result($result,$i,"jobid");
$name=mysql_result($result,$i,"company");
$email=mysql_result($result,$i,"email");
$location=mysql_result($result, $i, "location");
$desc=mysql_result($result,$i,"description");
$url=mysql_result($result,$i, "url");
echo "<br>$id<br>$name<br>$email<br>$location<br>$desc<br>$url<br>";
}
}//else
}
/*user arrived at this page without clicking on the remove button...*/
else
{
print_r($_POST);
printf("No option selected");
}
mysql_close();
?>
<center> <A href="bluetech.htm"> Click here</a> to return to Bluetech Mainpage.</center>
</body>
</html>
Please note:
I am posting to the form's ACTION and am not posting directly to the website/html
In this case the website i mention is:
http://www.eslteachersboard.com/cgi-bin/esljobs/index.pl?form=0
And the website form action is:
http://www.eslteachersboard.com/cgi-bin/esljobs/index.pl?post
Please let me know if there is anything else i can provide to solve this problem.
Thanks once again, gals and guys!