Jump to content

mattennant

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.matthewtennant.com

Profile Information

  • Gender
    Not Telling

mattennant's Achievements

Member

Member (2/5)

0

Reputation

  1. having resolved my earlier problem of inserting dates from drop down menus (thanks jeremy) i'm now trying to format the information entered. what i'm trying to achieve is an events calander formated something like this July 4/7/2005 event name event venue 7/7/2005 event name event venue 21/7/2005 event name event venue etc Aug 4/8/2005 event name event venue 7/8/2005 event name event venue 21/8/2005 event name event venue etc i have tried using the distinct date function, but that seems like a blind alley. I have no probs getting all the events in a long list, it would just be good to break them up a bit with the months. Is this possible? Any help much appreciated
  2. weirdly some extra spaces before the variables appear to have been causing my error, all is working fine now. Thanks a bunch
  3. thanks for that the principle makes sense, just that when i pasted the code i got the following error Parse error: parse error, unexpected T_VARIABLE in /home/fhlinux195/m/matthewtennant.com/user/htdocs/mainevent_1.php on line 9 i'm guessing i'm making a massive error. All the code belongs in the same page right?? thanks again mat
  4. hi there wonder if anyone can point me in the right direction with this one. I want to create a form where a user enters the date of an event. at present the only way i can manage this is if i get the user to enter todays date in a text box as (eg todays date) 20051227 which is sure going to confuse people. What i'm wondering is how complex a procedure, taking into account my noobie status, would it be to enter the date into one columns of a database using three drop down menus. Any help much appreciated thanks
  5. i think you are right a new direction is in order thanks for your help
  6. Thanks for your help i kind of understand the principle but the problem is dreamweaver is doing most of my coding. (i'm trying to break this habit) When i try and insert your suggestion, dreamweaver spews out errors. I'll post you the code with the hope you may be able to make some sense of it, apologies though, i know there's a lot of it. cheers <?php session_start(); ?><?php require_once('Connections/mattyboy.php'); ?> <?php function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO upshotaltclubvenues (email, clubname, clubaddressline1, clubaddressline2, clubtown, nightofthewek, capacity, promoter, promotertelephonenumber, promoteremail, albumplayback, dvdscreens, liveacts, celebritydjs, productpromotion) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['email'], "text"), GetSQLValueString($_POST['clubname'], "text"), GetSQLValueString($_POST['clubaddressline1'], "text"), GetSQLValueString($_POST['clubaddressline2'], "text"), GetSQLValueString($_POST['clubtown'], "text"), GetSQLValueString($_POST['nightoftheweek'], "text"), GetSQLValueString($_POST['capacity'], "text"), GetSQLValueString($_POST['promoter'], "text"), GetSQLValueString($_POST['promotertelephonenumber'], "text"), GetSQLValueString($_POST['promoteremail'], "text"), GetSQLValueString(isset($_POST['albumplayback']) ? "true" : "", "defined","'Y'","'N'"), GetSQLValueString(isset($_POST['dvdscreens']) ? "true" : "", "defined","'Y'","'N'"), GetSQLValueString(isset($_POST['liveacts']) ? "true" : "", "defined","'Y'","'N'"), GetSQLValueString(isset($_POST['celebritydjs']) ? "true" : "", "defined","'Y'","'N'"), GetSQLValueString(isset($_POST['productpromotion']) ? "true" : "", "defined","'Y'","'N'")); mysql_select_db($database_mattyboy, $mattyboy); $Result1 = mysql_query($insertSQL, $mattyboy) or die(mysql_error()); $insertGoTo = "reg2_1.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_mattyboy, $mattyboy); $query_venues = "SELECT * FROM upshotaltclubvenues"; $venues = mysql_query($query_venues, $mattyboy) or die(mysql_error()); $row_venues = mysql_fetch_assoc($venues); $totalRows_venues = mysql_num_rows($venues); ?> <form action="<?php echo $editFormAction; ?>" method="POST" name="form1">
  7. this may or may not be of use. http://www.dmcinsights.com/phorum/read.php?9,15119,15178 I think this guy could have had the same problem
  8. hello I have a form for DJ's to enter the details of the clubs they DJ at, on completing the form i want to offer the user 2 options option one - to submit the data and continue to the next step of the form option two - to submit the data and reset the existing form to enable them to submit details of further clubs. Is it possible to do this from multiple submit buttons on one page? any help appreciated
  9. thanks so much, that did the trick - cheers
  10. I realise now that not sending any code is a bit of a mistake, the problem still remains that when i add seesion start to the top of the page i get the following error Warning: Cannot modify header information - headers already sent by (output started at /home/fhlinux195/m/matthewtennant.com/user/htdocs/newscomment.php:3) in /home/fhlinux195/m/matthewtennant.com/user/htdocs/newscomment.php on line 61 a username does get added to my database via a hidden field as required is there a problem with session variable when iserting fields in dreamweaver? here comes the reams of code line 61 is header(sprintf("Location: %s", $insertGoTo)); thanks <?php session_start(); ?> <?php require_once('Connections/mattyboy.php'); ?> <?php $colname_Recordset1 = "1"; if (isset($_GET['recordID'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['recordID'] : addslashes($_GET['recordID']); } mysql_select_db($database_mattyboy, $mattyboy); $query_Recordset1 = sprintf("SELECT * FROM studentvillagenews WHERE number = %s", $colname_Recordset1); $Recordset1 = mysql_query($query_Recordset1, $mattyboy) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> <?php require_once('Connections/mattyboy.php'); ?> <?php function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO studentvillagenewscomment (numcat, comment, username) VALUES (%s, %s, %s)", GetSQLValueString($_POST['numcat'], "int"), GetSQLValueString($_POST['comment'], "text"), GetSQLValueString($_POST['username'], "text")); mysql_select_db($database_mattyboy, $mattyboy); $Result1 = mysql_query($insertSQL, $mattyboy) or die(mysql_error()); $insertGoTo = "news.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <p> </p> <form method="post" name="form1" action="<?php echo $editFormAction; ?>"> <table align="center"> <tr valign="baseline"> <td nowrap align="right" valign="top">Comment:</td> <td><textarea name="comment" cols="50" rows="5"></textarea> </td> </tr> <tr valign="baseline"> <td nowrap align="right" valign="top"> </td> <td> </td> </tr> <tr valign="baseline"> <td nowrap align="right"> </td> <td><input type="submit" value="Insert record"></td> </tr> </table> <input type="hidden" name="numcat" value="<?php echo $row_Recordset1['number']; ?>"> <input type="hidden" name="MM_insert" value="form1"> <input name="username" type="hidden" id="username" value="<?php echo $_SESSION['surname']; ?>"> </form> <p> </p> </body> </html> <?php mysql_free_result($Recordset1); ?>
  11. hello i'm trying to create a page where a user enters a name and password into the database. After inserting the users name is passed as a session variable to a thankyou page. I've got no problems passing a session variable from a standard form (i.e not an insert record) but when i try and retrieve the session variable after inserting these user details nothing appears. here's hoping someone has the answer. thanks mat
×
×
  • 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.