Jump to content

bryanptcs

Members
  • Posts

    49
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bryanptcs's Achievements

Member

Member (2/5)

1

Reputation

  1. I have a contact form and it used to work. I think I might have changed versions of php but I am not sure what I had before. It is now running 5.1.6, here is the php code for the form. This is the error I am getting, it is from the last line of the PHP code: "Error: Please press back on your browser and try again." <?php $EmailTo = "bryanedwards05@gmail.com"; $contactsubject= Trim(stripslashes ($_POST['subject'])); $Name= Trim(stripslashes ($_POST['name'])); $HomeTel= Trim(stripslashes ($_POST['phone'])); $Email= Trim(stripslashes ($_POST['email'])); $Message= Trim(stripslashes ($_POST['message'])); $EmailFrom = $Email; // validation $validationOK=true; if (Trim($Name)=="") $validationOK=false; if (Trim($contactsubject)=="") $validationOK=false; if (Trim($Email)=="") $validationOK=false; if (Trim($Message)=="") $validationOK=false; if (!$validationOK) { echo "The form was not properly sent, please press back on your browser and make sure all required feilds are entered and try again. Thank you."; exit; } $Subject = "ChristKidz.com Contact Form " . $contactsubject; $Body =""; $Body .="Name: "; $Body .=$Name; $Body .="\n"; $Body .="Phone: "; $Body .=$HomeTel; $Body .="\n"; $Body .="Email: "; $Body .=$Email; $Body .="\n"; $Body .="\n"; $Body .="Message: "; $Body .="\n"; $Body .=$Message; $Body .="\n"; $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>", $ReplyTo); if ($success) { echo "The Following Message has succesfully been sent to the childrens ministry:<br><br>"; echo "Name: $Name<br>"; echo "Phone: $HomeTel<br>"; echo "Email: $Email<br><br>"; echo "Subject: $Subject<br><br>"; echo "Message: $Message<br><br>"; echo "Thank you for your questions or comments, we will reply to them as soon as possible. Have a great day"; } else { echo "Error: Please press back on your browser and try again."; } ?>
  2. I am running Mambo 4.6.1 and have installed the extCalendar component with the latest events module and when the latest events mod runs it produces the following errors: Warning: Invalid argument supplied for foreach() in /home/oviedocc/public_html/modules/mod_extcalendar_latest.php on line 123 Warning: Invalid argument supplied for foreach() in /home/oviedocc/public_html/modules/mod_extcalendar_latest.php on line 171 Warning: Invalid argument supplied for foreach() in /home/oviedocc/public_html/modules/mod_extcalendar_latest.php on line 239 Anybody have any ideas why it might be doing this? Thanks.
  3. ok, so I have a form that is submitted to the DB containing client info and a thumbnail. I also have a program that calls the data from the DB and displays the info in a table. The problem I am having is in displaying the thumbnail. It just displays a lot of code that i guess makes up the image. Anyways, below is my code. Any help would be great. Thanks. the upload form <?php include ("db.inc"); $connection = mysql_connect($host, $user, $password) or die ("Couldn't connect to the server"); $db = mysql_select_db($database, $connection) or die("could not select the DB"); $companyName = Trim(stripslashes($_POST['companyName'])); $companyWeb = Trim(stripslashes($_POST['companyWeb'])); $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } $sql = "INSERT INTO ClientList (companyName, companyWeb, name, size, type, content) VALUES ('$companyName', '$companyWeb', '$fileName', '$fileSize', '$fileType', '$content')"; $result = mysql_query($sql) or die ("Could not execute query"); if($result == "yes") { header("Location: viewclient.php"); echo "Client Successfully Added"; exit; } ?> the view the data code <?php include("db.inc"); $connection = mysql_connect($host, $user, $password) or die ("Could not connect"); $db = mysql_select_db($database, $connection) or die ("Could not connect to DB"); if ($_POST['delete']){ $deleteID = $_POST['delete']; mysql_query("DELETE FROM ClientList WHERE companyName = '$deleteID'") or die (mysql_error()); echo "Successfully Deleted Client<p>"; } $sql = "SELECT * FROM ClientList ORDER BY companyName"; $result = mysql_query($sql) or die("Could not execute query"); echo "<table cellpadding='0' border='1' cellspacing='0' width='500' align='center'>"; echo "<tr><td><font size='-2'>Press Below Button to Delete</font></td><td>Company Name</td>"; echo "<td>Company Web Site</td><td>Thumbnail</td></tr>"; while ($row = mysql_fetch_array($result)) { extract($row); echo "<tr><td align='center'><form id='form1' name='form1' method='post' action='{$_SERVER['PHP_SELF']}'><input type='submit' name='delete' value='{$row['companyName']}' /></form><td>"; echo $companyName."</td>"; echo "<td><a href='http://".$companyWeb."' target='_blank'>".$companyWeb."</a></td>"; echo $content; echo "</tr>"; } echo "</table>"; ?>
  4. Ok, I have a pretty simple table to view my DB items through the website...what I want to be able to do is push the submit button and have it delete the row that coincides with the button....is this possible? Below is my code...I have left the action for the submit button form as XXX b/c I don't know what to put there. Thanks for your help. <?php include("db.inc"); $connection = mysql_connect($host, $user, $password) or die ("Could not connect"); $db = mysql_select_db($database, $connection) or die ("Could not connect to DB"); $sql = "SELECT * FROM ClientList ORDER BY companyName"; $result = mysql_query($sql) or die("Could not execute query"); echo "<table cellpadding='0' border='1' cellspacing='0' width='500' align='center'>"; echo "<tr><td></td><td>Company Name</td>"; echo "<td>Company Web Site</td></tr>"; while ($row = mysql_fetch_array($result)) { extract($row); echo "<tr><td><form id='form1' name='form1' method='post' action='XXXX'><input type='submit' name='Submit' value='Submit' /></form><td>"; echo $companyName."</td>"; echo "<td><a href='http://".$companyWeb."' target='_blank'>".$companyWeb."</a></td>"; echo "</tr>"; } echo "</table>"; ?>
  5. Is there any kind of code/function that will send a table from my db to the printer?
  6. I found out the problem...when I changed the form action to call the same page...I forgot to change it on the .inc file...Your code def. did the trick though...Thanks a lot...
  7. ok, here is my updated code, but still nothing is happening...no errors, no post to the db...it just refreshes the page basically. [code] <?php include('incl_db.php'); include('function.inc'); if ($_POST['Submit']) { $connection = mysql_connect($host, $user, $password) or die ("Couldn't connect to the server."); // Connect $db = mysql_select_db($database, $connection) or die ("Couldn't select database."); $table_id = Trim(stripslashes($_POST['table_id'])); //Set variables $company = Trim(stripslashes($_POST['company'])); $amt_tix = Trim(stripslashes($_POST['amt_tickets'])); $comments = Trim(stripslashes($_POST['comments'])); $sql = "SELECT * FROM `Table` WHERE `table_id`='".$table_id."'"; // SQL statement - select all from table where the table id matchs the inputted one $result = mysql_query($sql) or die("could not execute! ".mysql_error()); $num = mysql_num_rows($result); // If any matches... if($num > 0) { print "That table has already been reserved.)"; // tell the user that is has been taken include ("reservetable_form.inc"); //show form exit; // exit script } else { $sql2 = "INSERT INTO `Table` ( `table_id` ,`company` , `table_amt` , `comments` ) VALUES ('".$table_id."' , '".$company."', '".$amt_tix."', '".$comments."')"; //SQL statement for inserting into the DB $result2 = mysql_query($sql2)  or die("Couldn't execute query. ".mysql_error()); header("Location: index.php"); // Go back to index } } else { include('reservetable_form.inc');//show form if it has not been submitted } ?> [/code]
  8. Ok, I have a form that I am having submitted to the db.  The only catch is that I need it to validate the field table_id does not have the same value twice.  I am using it as sort of a table reservation form where there are 50 tables to choose from, and each table can only be used once.  Here is my below code.  Right now, it is running the program and not doing anything...not posting to the db and not creating any errors...it just brings the form back up.  Here is a link to see it actually working (or not working): http://www.giftfromgodcomputerfoundation.org/staff/reservetable.php [code] <?php include('incl_db.php'); include('function.inc'); $connection = mysql_connect($host, $user, $password) or die ("Couldn't connect to the server."); $db = mysql_select_db($database, $connection) or die ("Couldn't select database."); ?> <?php   include("reservetable_form.inc");     if ($_POST['Submit']) { include("incl_db.php"); $connection = mysql_connect($host, $user, $password) or die ("Couldn't connect to the server."); $db = mysql_select_db($database, $connection) or die ("Couldn't select database."); $table_id = Trim(stripslashes($_POST['table_id'])); $company = Trim(stripslashes($_POST['company'])); $amt_tix = Trim(stripslashes($_POST['amt_tickets'])); $comments = Trim(stripslashes($_POST['comments'])); $sql = "SELECT table_id FROM `Table`"; $result = mysql_query($sql) or die("could not execute1"); $num = mysql_numrows($result); if ($num > 0) { print "That table has already been reserved.)"; include ("reservetable_form.inc"); exit; } else { $sql2 = "INSERT INTO `Table` ( `table_id` ,`company` , `table_amt` , `comments` ) VALUES ('$table_id' , '$company', '$amt_tix', '$comments')"; $result2 = mysql_query($sql2)  or die("Couldn't execute query."); header("Location: index.php"); } //} } ?> [/code] here is the form: [code] <form action="reservetable_action.php" method="POST"> <table border="0"> <tr>   <td align="right"><b>Corporation</b></td>   <td><input name="company" type="text" id="company" size="30" maxsize="50" /></td></tr> <tr>   <td width="120" align="right"><b>Amount of Tickets </b></td>   <td><select name="amt_tickets" id="amt_tickets">         <option value="2">2</option>         <option value="4">4</option>         <option value="6">6</option>       </select></td> </tr> <tr>   <td align="right">Table Required </td>   <td><select name="table_id">   <?php   $tableName=getTableName(); $tableCode=getTableCode(); for ($n=1; $n<=54; $n++) { $table=$tableName[$n]; $tcode=$tableCode[$n]; echo "<option value='$tcode'"; if ($scode== "A1") echo " selected"; echo ">$table\n"; } ?></select> <?php echo $new_message; ?>     </td> </tr> <tr>   <td align="right"><strong>Comments</strong></td>   <td rowspan="4" valign="top"><label>     <textarea name="comments" cols="30" rows="6" id="comments"></textarea>   </label></td>   </tr> <tr>   <td align="right">&nbsp;</td>   </tr> <tr>   <td align="right">&nbsp;</td>   </tr> <tr>   <td align="right">&nbsp;</td>   </tr> <tr><td align="center" colspan="2"><br /><input name="Submit" type="submit" id="Submit" value="Submit" /> </td></tr> </table> </form> [/code]
  9. yes... [code] <form action="reservetable_action.php" method="POST"> <table border="0"> <tr>   <td align="right"><b>Corporation</b></td>   <td><input name="company" type="text" id="company" size="30" maxsize="50" /></td></tr> <tr>   <td width="120" align="right"><b>Amount of Tickets </b></td>   <td><select name="amt_tickets" id="amt_tickets">         <option value="2">2</option>         <option value="4">4</option>         <option value="6">6</option>       </select></td> </tr> <tr>   <td align="right">Table Required </td>   <td><select name="table_id">   <?php   $tableName=getTableName(); $tableCode=getTableCode(); for ($n=1; $n<=54; $n++) { $table=$tableName[$n]; $tcode=$tableCode[$n]; echo "<option value='$tcode'"; if ($scode== "A1") echo " selected"; echo ">$table\n"; } ?></select> <?php echo $new_message; ?>     </td> </tr> <tr>   <td align="right"><strong>Comments</strong></td>   <td rowspan="4" valign="top"><label>     <textarea name="comments" cols="30" rows="6" id="comments"></textarea>   </label></td>   </tr> <tr>   <td align="right">&nbsp;</td>   </tr> <tr>   <td align="right">&nbsp;</td>   </tr> <tr>   <td align="right">&nbsp;</td>   </tr> <tr><td align="center" colspan="2"><br /><input name="Submit" type="submit" id="Submit" value="Submit" /> </td></tr> </table> </form> [/code] Sorry about the indention...I am usually pretty good about it.
  10. i did that (updated code below) and it just produced a blank page. [code] <?php ob_start(); ?> <?php if ($_POST['submit']) { include("incl_db.php"); $connection = mysql_connect($host, $user, $password) or die ("Couldn't connect to the server."); $db = mysql_select_db($database, $connection) or die ("Couldn't select database."); $table_id = Trim(stripslashes($_POST['table_id'])); $company = Trim(stripslashes($_POST['company'])); $amt_tix = Trim(stripslashes($_POST['amt_tickets'])); $comments = Trim(stripslashes($_POST['comments'])); $sql = "SELECT $table_id FROM `Table`"; $result = mysql_query($sql) or die("could not execute"); $num = mysql_numrows($result); if ($num > 0) { $new_message = "That table is already reserved"; //header("Location: reservetable.php"); include("reservetable.php"); exit; } else { $sql2 = "INSERT INTO `Table` ( `table_id` ,`company` , `table_amt` , `comments` ) VALUES ('$table_id' , '$company', '$amt_tix', '$comments')"; $result2 = mysql_query($sql2) or die("Couldn't execute query."); if ($result2 == "yes") { header("Location: index.php"); exit; } } } ?> [/code]
  11. putting the $ in front of table_id errors the sql command and causes it not to execute...
  12. Ok, I have made the changes...but it does not seem like the program is running.  It just puts the message that the table already exists, even when it doesn't exist yet... here is my updated code [code] <?php ob_start(); ?> <?php include("incl_db.php"); $connection = mysql_connect($host, $user, $password) or die ("Couldn't connect to the server."); $db = mysql_select_db($database, $connection) or die ("Couldn't select database."); $table_id = Trim(stripslashes($_POST['table_id'])); $company = Trim(stripslashes($_POST['company'])); $amt_tix = Trim(stripslashes($_POST['amt_tickets'])); $comments = Trim(stripslashes($_POST['comments'])); $sql = "SELECT table_id FROM `Table`"; $result = mysql_query($sql) or die("could not execute"); $num = mysql_numrows($result); if ($num > 0) { $new_message = "That table is already reserved"; //header("Location: reservetable.php"); include("reservetable.php"); exit; } else { $sql2 = "INSERT INTO `Table` ( `table_id` ,`company` , `table_amt` , `comments` ) VALUES ('$table_id' , '$company', '$amt_tix', '$comments')"; $result2 = mysql_query($sql2) or die("Couldn't execute query."); if ($result2 == "yes") { header("Location: index.php"); exit; } } ?> [/code]
  13. I need to check to see if the value for table_id already exists in the db.  If it does, a message needs to post and allow the user to choose a dif table id. Here is what i have...i get the die message of could not execute query for $sql. Any help? [code] <?php include("incl_db.php"); $connection = mysql_connect($host, $user, $password) or die ("Couldn't connect to the server."); $db = mysql_select_db($database, $connection) or die ("Couldn't select database."); $table_id = Trim(stripslashes($_POST['table_id'])); $company = Trim(stripslashes($_POST['company'])); $amt_tix = Trim(stripslashes($_POST['amt_tickets'])); $comments = Trim(stripslashes($_POST['comments'])); $sql = "SELECT table_id FROM Table"; $result = mysql_query($sql) or die("could not execute"); $num = mysql_numrows($result); if ($num > 0) { echo "That table is already reserved"; header("Location: reservetable.php"); } else { $sql2 = "INSERT INTO `Table` ( `table_id` ,`company` , `table_amt` , `comments` ) VALUES ('$table_id' , '$company', '$amt_tix', '$comments')"; $result2 = mysql_query($sql2) or die("Couldn't execute query."); if ($result2 == "yes") { header("Location: index.php"); exit; } } ?> [/code]
  14. I am trying to come up with a program that list available seating options for the amount of people that they choose...I am not going to get too crazy...I am only giving them the option of a two seater, 4, and six seater. I have a mysql db setup with a list of tables and the amount each table holds. I want my user to be able to select from the amount of tickets list (2,4, or 6) and have then have the next list which is calling all the the tables from the db to automatically update with the tables that will hold that amount. Here is what I have so far.... [code] <form action="reservetable_action.php" method="POST"> <table border="0"> <tr>   <td align="right"><b>Corporation</b></td>   <td><input name="company" type="text" id="company" size="30" maxsize="50" /> </td></tr> <tr>   <td width="120" align="right"><b>Amount of Tickets </b></td>   <td><label>     <select name="amt_tickets" id="amt_tickets">       <option value="2">2</option>       <option value="4">4</option>       <option value="6">6</option>         </select>   </label></td> </tr> <tr>   <td align="right"><strong>Select Table </strong></td>   <td> <?php echo "<label>"; echo "<select name='list_table' id='list_table'>"; while ($row = mysql_fetch_array($result)) { extract($row); echo "<option value='".$table_id."'>"; echo $table_id; echo "</option>"; } echo "</select>"; echo "</label>"; ?></td> </tr> <tr>   <td align="right" valign="top">&nbsp;</td>   <td valign="top"><p>&nbsp;</p>     </td> </tr> <tr>   <td align="right"><strong>Comments</strong></td>   <td rowspan="4" valign="top"><label>     <textarea name="comments" cols="30" rows="6" id="comments"></textarea>   </label></td>   </tr> <tr>   <td align="right">&nbsp;</td>   </tr> <tr>   <td align="right">&nbsp;</td>   </tr> <tr>   <td align="right">&nbsp;</td>   </tr> <tr><td align="center" colspan="2"><br /><input name="Submit" type="submit" id="Submit" value="Submit" /> </td></tr> </table> </form> [/code] Right now, this lists all tables regardeless of what was input into the amount of tix list.  Any ideas?  Thanks.
  15. I also realized that it should have been... header("Location: url"); instead of header('url'); Thanks for you help.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.