Jump to content

Recommended Posts

Hi all.

 

I was wondering if someone could help me out on this basic form I have created.

The two pages are below and what I want to do is add this http://www.ama3.com/anytime/

But after trying all sorts, I cantt get it right, hence a field to enter it manually.......

 

insert.php

<?php
// Define your username and password
$username = "user";
$password = "password";
if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) {
?>
<h1>Login</h1>
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p><label for="txtUsername">Username:</label>
<br /><input type="text" title="Enter your Username" name="txtUsername" /></p>
<p><label for="txtpassword">Password:</label>
<br /><input type="password" title="Enter your password" name="txtPassword" /></p>
<p><input type="submit" name="Submit" value="Login" /></p>
</form>
<?php
}
else {
?>
<body>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="insert_ac.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td colspan="3"><strong>Send Message </strong></td>
</tr>
<tr>
<td width="71">To</td>
<td width="6">:</td>
<td width="301"><input name="MessageTo" type="varchar(80)" id="MessageTo"></td>
</tr>
<tr>
<td>Message</td>
<td>:</td>
<td><textarea name="MessageText" id="MessageText"></textarea></td>
</tr>
<tr>
<td>Time</td>
<td>:</td>
<td><input name="Scheduled" type="datetime" id="Scheduled" value="YYY-MM-DD HH:MM:00"></td>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
<?php
}
?>

 

insert_ac.php

 

<?php
$host="localhost"; // Host name
$username="*****"; // Mysql username
$password="*****"; // Mysql password
$db_name="sms"; // Database name
$tbl_name="messageout"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// Get values from form
$MessageTo=$_POST['MessageTo'];
$MessageText=$_POST['MessageText'];
$Scheduled=$_POST['Scheduled'];
// Insert data into mysql
$sql="INSERT INTO $tbl_name(MessageTo, MessageText, Scheduled)VALUES('$MessageTo', '$MessageText', '$Scheduled')";
$result=mysql_query($sql);
// if successfully insert data into database, displays message "Successful".
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='insert.php'>Back to main page</a>";
}
else {
echo "ERROR";
}
?>
<?php
// close connection
mysql_close();
?>

Link to comment
https://forums.phpfreaks.com/topic/271636-form-help-needed/
Share on other sites

Make sure to include all the javascript files you need. Then try this and see if it works:

 

<input name="Scheduled" type="datetime" id="Scheduled" />
<script>
$("#Scheduled").AnyTime_picker(
{ format: "%Y-%m-%d %H:%i:%s %E %#",
formatUtcOffset: "%: (%@)",
hideInput: true,
placement: "inline" } );
</script>

Edited by parkerj
Link to comment
https://forums.phpfreaks.com/topic/271636-form-help-needed/#findComment-1397710
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.