DevelopPHP.com 2010 Discussion Archive(not active)

 

Forum Index >> JavaScript Forum

making a jquery event maker
   THREAD CLOSED
making a jquery event maker
by Joesmith - Wed Feb 09, 2011 09:31:59 AM
RIGHT as you guys prob know from some previous posts i have started to learn jquery and AJAX but this is my problem 

-------------------------------------JQUERY---------------------------------------
    $(document).ready(function(){
$('.submit').click(function() {

var event_date = $("#event_date").val();
var event_time = $("#event_time").val();
var the_event = $("#the_event").val();
var user_id = $("#user_id").val();
var user_name = $("#user_name").val();
var public_op = $("#public").val();
var youtube = $("#youtube").val();
var vimeo = $("#vimeo").val();
var dataString =
'event_date=' + event_date +
'&event_time=' + event_time +
'&the_event=' + the_event +
'&user_id=' + user_id +
'&user_name=' + user_name +
'&public_op=' + public_op; +
'&youtube=' + youtube; +
'&vimeo=' + vimeo; 
if(the_event=='') { //the event field is blank
  alert('There was nothing in the event box when we check, please try again.');
}else{
 
$("#flash").show();
$("#flash").fadeIn(400).html('<span class="loading">Adding new event...</span>');

    $.ajax({
   type: "POST",
  url: "scripts/addevent.php",
  data: dataString,
  cache: false,
  success: function(html){


-------------------------------------- SCRIPTS/ADDEVENT.php--------------------------------

<?
session_start();
include"connect_to_mysql.php";
if($_POST)
{
$event_date = $_POST['event_date'];
$event_time = $_POST['event_time'];
$the_event = $_POST['the_event'];
$user_id = $_POST['user_id'];
$user_name = $_POST['user_name'];
$public_op = $_POST['public_op'];
$youtube = $_POST['youtube'];
$vimeo = $_POST['vimeo'];

$sql = mysql_query("INSERT INTO diary_events (event_time, event_date, event_text, event_user_id, event_username, youtube, vimeo) VALUES 
('$event_time', '$event_date', '$the_event', '$user_id', '$user_name','$youtube','$vimeo') ")
 or die (mysql_error());
$outmessage .='<div class="added">Your new event was added.</div>';
}
?>


------------------------------------------ PROBLEM--------------------------------------
right everything inserts into the database but the $public and $youtube and $vimeo can you guys see any problems - i am new to jquery and would love your help

RE: making a jquery event maker
by Joesmith - Wed Feb 09, 2011 09:45:51 AM
HTML ____________________________________________________________________________________

      <form action="#" method="post" name="NewEvent" id="NewEvent">
      <table width="100%" cellpadding="0" cellspacing="0" id="update">
      <tr>
      <td colspan="5">
      <br />
<div align="center" style="font-weight:500; font-size:16px;">
 Add a new event to today.<span style="font-size:12px;">(The public settings and attaching videos are under construction)</span>
</div>
      </td>
      </tr>
      <tr>
        <td colspan="5"><div align="center">
          <textarea name="the_event" id="the_event" cols="159" rows="5"></textarea>
          <input type="hidden" name="the_date" id="event_date" value="<?php print"$date";?>" />
          <input type="hidden" name="the_time" id="event_time" value="<?php print"$time";?>"  />
          <input type="hidden" name="user_id" id="user_id" value="<?php print"$id";?>" />
          <input type="hidden" name="user_name" id="user_name" value="<?php print"$username";?>" />
          </div></td>
      </tr>
      <tr>
        <td colspan="5"><?php print"$outmessage";?></td>
      </tr>
      <tr>
        <td colspan="5"><div align="center"><strong>ATTACH A VIDEO</strong>:  Youtube:
<input name="youtube" type="text" id="youtube" size="40" placeholder="http://www.youtube.com/watch?v=...." /> 
          or Vimeo:
          <input name="vimeo" type="text" id="vimeo" size="40" placeholder="http://vimeo.com/..." /> 
          (optional)</div></td>
      </tr>
      <tr style="background:#CCC; border:1px solid #333;">
        <td width="25%"><div align="right">
          <input type="radio" name="public" id="public" value="0" checked="checked" /> 
          Public (World Wide)</div></td>
        <td width="21%"><div align="right">
          <input type="radio" name="public" id="public" value="1" /> 
          Private (You and Followers)</div></td>
        <td width="21%"><div align="right">
          <input type="radio" name="public" id="public" value="2" /> 
          Uber Private (Just You)</div></td>
        <td width="23%"><div align="right">
          <input type="submit" name="submit" class="submit" value="Add to my diary" />
        </div></td>
        <td width="10%"><span id="flash"></span></td>
      </tr>
      </table>
      </form>

   THREAD CLOSED  
©2009 DevelopPHP.com