Jump to content

javascript prompt box then store input on database


violinrocker

Recommended Posts

<input type="button" value="prompt box" name="B3" onClick="prompt('Prompt boxes allow the user to enter text or a value!','Enter your text here')">

 

I found this javascript prompt box code and thought that it would work great with my site,

how do I use it with the following code to store data in my database?

 

<?php
$con = mysql_connect("host","user","pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("database", $con);

$sql="INSERT INTO broken_links (r_title, page_id, r_date, r_expiry, r_message)
VALUES
('$_GET[title]','$_GET[page_id]',NOW(), DATE_ADD(NOW(), INTERVAL 2 MONTH), $POST[r_message])";

if (!mysql_query($sql,$con))
  {
  }
echo "Your Report has been sent! thank you for sending a report, the administrators will fix it as soon as they see your report";

mysql_close($con)
?> 

Link to comment
Share on other sites

  • 4 years later...
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.