Wrox Programmer Forums
|
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 5th, 2005, 07:12 AM
Registered User
 
Join Date: Jan 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem combining PHP and JavaScript

Anyone out there who can help with linking JavaScript and PHP?

I have acquired some script that processes data collected from a <form> and then attaches the data to the URL of the page that will receive it. This works fine, except that I do not get an ‘action’ that I can process using a $_REQUEST statement on the receiving page.

The details are:
The html form collects data and then the JavaScript is activated by calling the submitForm() JavaScript function using onClick.
The key parts of the Form html are:

<form method="get" action="sorter_test1.php" name="form">
.
.
.
<input type="button" value="Set Headline Order" onClick="submitForm()">


The submitForm JavaScript function then processes and creates two strings. document.form.action takes the URL from the ‘action’ attribute in the <form> tag and theList is a data string ‘?fred=12345’ .

The following statement transfers control to the next page with a URL http://sorter_test1,php?fred=1234

location.href = document.form.action + theList;

My problem is that I would also like to pass the ‘Set Headline Order’ value in the <input> tag so that I see it using a $_REQUEST in the receiving page (sorter_test1.php). Can anyone suggest how I can fix this? I suspect there is a statement that I can add to the JavaScript, but as I know precious little about JavaScript I cannot work out what it should be.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining PHP and C++ Waffles C++ Programming 0 August 3rd, 2007 01:20 PM
Combining Javascript and ASP chuksted C# 5 June 16th, 2005 10:25 AM
PHP and Javascript davidhayter Beginning PHP 5 May 6th, 2005 05:33 AM
How to use javascript with php? raichand_ray PHP How-To 2 November 12th, 2004 06:41 AM
JavaScript and php Bandy PHP How-To 2 February 10th, 2004 04:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.