Current location: Hot Scripts Forums » General Web Coding » JavaScript » Javascript Prompt w/form submit


Javascript Prompt w/form submit

Reply
  #1 (permalink)  
Old 10-20-11, 10:52 AM
Tuxxin's Avatar
Tuxxin Tuxxin is offline
New Member
 
Join Date: Oct 2011
Location: Orlando, FL
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Javascript Prompt w/form submit

I'm trying to get an option to where when you click on an html button it will popup and ask you for information (in this case a tracking number). The field will auto have a tracking number there and highlighted, the option is only if they want to change the tracking number.

Below is the code I have and I've tried multiple variations of it but can't get it to do fully what I need.

PHP Code:

<form method="post" action="' . $_SERVER[SCRIPT_NAME] . '" name="picked_up">

<
script type="text/javascript">
function 
show_prompt()
{
var 
tracknum=prompt("Shipment Tracking Number","' . $row[tracking_num] . '");
if (
tracknum!=null && tracknum!="")
  {
        
document.write(tracknum);
  }
}                    
</script>
<input onclick="show_prompt()" type="button" name="picked_up" value="Package Received">
</form> 
That code below works correctly but reloads the page and only displays whatever was entered into the prompt box.

How can I get this to submit "tracknum" into a post variable?

Thanks.
Reply With Quote
Reply

Bookmarks

Tags
form, javascript, php, php and javascript


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript - Auto Submit Form - Whilst Input Name = Submit ultimatewarrior JavaScript 3 12-24-10 11:50 PM
Senior JavaScript Developer - Full Time - Permanent - London AJAX, CSS, JSONP Chris Peacock Job Offers & Assistance 0 01-19-10 12:28 PM
Submit a Javascript button and execute PHP zoliky JavaScript 1 09-26-06 02:32 AM
Submit form (JavaScript) not working Any one Help! andrewvideo JavaScript 15 05-07-05 08:56 PM
Submit button on forms civrob PHP 4 08-10-04 04:22 PM


All times are GMT -5. The time now is 02:05 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.