Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Values In Form Not Passed Using Onclick ?


i have a php file name main.php i want to do a post and not a get since this action is to delete a row in the database. however, when i try to do a href onclick, the values are not passed to the main.php. why ? Code:

echo "You have " .$votesattach. " votes for this quote. Delete the Quote and Votes ?";
echo "<form name=send1 method=post action=main.php?action='deleteit'>";
echo "<input type=hidden name=action value=deleteit>";
echo "<input type=hidden name=which value=$delete>";
echo "<input type=hidden name=userno value=$userno></form>";
echo "<a href=main.php onclick=document.send1.submit()>YES</a>";}

how do i do pass values to the server using a post method ?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Encrypting Variable Values Passed Thru A Link In A Web Page
I am working on a project in PHP / Mysql on linux platform. The project has a login page where any registered user is supposed to login before he/she can have access to some major functionalities in the project.

Since I need to check the authenticity of the user in other secured pages, I have to carry forward the username with which he/she has logged. As I am doing so, the username is appearing in the url. This of course is a major security lapse.

Variables Not Passed From Url Or Form To Page
I use a Mac at home running OSX 10.2, and use the Apache PHP MySQL trio for developing and testing sites. I've had very good experiences with this setup and have had no major problems till now.

I noticed recently that variables added to the end of the url (the get method, ...url/page.php?var=value) are not passed to the script within the page. Forms using either the get or post method have the same problem. For example, a page named "foobar.php" containing this: Code:

When A Value Passed In Form Or Q'string Is Empty..
I am trying to figure out how to deal with when not all elements
in a submitted form are filled out or when page expects a query string
and doesn't get one.. I tried the two conditionals below, but still got
errors:

$param= $_GET['msg'];

/*
if ($param != "") {
echo $param;
}
*/

if (isset($param)) {
echo $param;
}

query string is:

home.php?msg=selected records have been deleted from the database.

(referrer pg is not always pg sending query string.. so need to deal
w/when no query string is passed..)

PHP Not Populating Form Variables Passed Through POST Or GET
I"m running:

Windows Xp SP2
Apache2
PHP5
MySQL4

Everything seems fine and dandy, and I can do scripting on server side, but for some reason I cannot get data from a form to be put into a variable.

I have a simple form in an html page which submits, and in the php script that handles the input, none of the data in the form is going into the variables.

My php.ini file does have all the GPC's in place(ie variable_order, the way they get processed).

Comparing User Input Values In A Form With Database Values
I want to compare user input values in a form with my database.
Basically I want to check whether the user exits in my database.
What mysql command can do that?

Add Form Field Values Into Php Seesion Variable Before Submitting The Form
I have php page which is basically a simple html form containing some text fields.The user will type in values in it and submit it .Now what i want is that just at the time of submittion i want to assign the form field values in session variables.

I nwwd this b'coz the form is being submitted into a cgi script which has been given to me.Now the cgi script is an executable one and i am unable to view or change its content,Its functionability is to change a password for a linux user account .Now the cgi script after completing the job is redirected to another html page.What i have to do is that i need to trap the user input and update the values in a mysql database .Now if i can assign the values in a session variable then i can do the updatation from some later pages.

Form Submission Fills Form Values With Garbage
I'm attempting to do some form processing on a server that has register_globals off, however, I've run into a confusing situation and need some help.

Basically, the form is a multi-part/form-data form as I have it upload a file in addition to submit a number of other fields, but the error I have occurs even when no upload is done.

When I submit the form, all my input field variables get filled with garbage. Here's the html before submission for one of the fields: Code:

OnClick
Does php work with onClick in an html input statement?

<HTML>
<input type="button" name="add_picture" value="Add another picture"
onClick="<?php picture_count(); ?>">

I want to call the function picture_count() when button labeled "Add another
picture" is clicked in HTML

I do not want to use submit in place of button since I do not want to submit
the form at this time.

With the above statement, I receive an error expected ";" and the function
is not called.

<a Href Onclick --> Php?
Is there any way to change a $_POST variable when someone clicks on a link?

(Situation is: I have three buttons, saying, e.g. "view all blank cards". When the user clicks a button, I want to take them to greetingscards.php, with the $_POST variable ['message' set to Blank - the POST variable is used in the SQL used to retrieve the cards.) Code:

Onclick Confirm
I have a form button that I would like to have a confirmation pop up before submit like this:

<input name="delivered_id" type="hidden" value="id21" />
<input type="button" name="deliverconf" value="Deliver" onclick="temp = window.confirm('Confirm Delivery?');">

The confirm message with Ok and Cancel pops up, but it seems like my temp" variable gets set. Then I have do this, with no success: Code:

Sending A Value With 'onClick'
I want to send a php variable (the current URL) to a new .php file without doing it through a form/hidden field - but i need a button - so i though I could do it somehow with 'onClick'? Is this possible and how?

Changing A Variable Onclick
How can I in php have a link that reloads the exact same page but
before reloading, changes some variables?

Deleting Files Onclick
I have an app that lists out the files on a server.  I have a checkbox at the end of each file.  You can check any number of files.  Then I have a link at the top that says "delete selected files."  Could someone just tell me how to write the code to delete the files in general?  I'm not asking for all the exact code, just the concept.  I assume I will be calling a php or javascript function with the "onclick" method. Code:

Onclick Won't Open New Window Until After Refresh
I have a number of links to other pages in the current page. When the page
is initially loaded
none of the "onclick" events that call a Javascript to do a "window.open"
work. However, if I merely
click the window "Refresh" then all work. I'm pretty sure it's something I
did in the code, but after
2 days of trying and backtracking and hours of googling, perhaps someone
could suggest some
things to look for or try. The source language is PHP, and the browser is
IE6.

Values From A Form
I have a form (search.html) that has 1 textbox and 3 listboxes. When I submit this form to a php file (search_res.php), I am using $HTTP_POST_VARS to get the values which is fine.

But then in my php file(search_res.php) I again have a listbox with 2 options. When I choose either one of these options to display the search results either by "Price" or "Name" I lose the values of the main form (search.html). How can I keep these values from the main form in my search_res.php page?

Getting Form Values
I have so far been trying to get all selected check boxes on the page, quantity text fields and ordernotes text area to INSERT INTO my database but to no avail. Im using OBDC to add to the confusion.

I've tried to develop my 'product' script into some kind of a form, but now need to find out how to make the data i want variable so that i can send them into my database. Code:

Reload Outside Page OnClick Of Submit Button
I'm using frames to create a "bookmark-like" page. You can enter a URL and it gets added to my database. I have two frames (leftFrame - to display bookmarks entered and mainFrame to show web page). I want the leftFrame to automatically refresh when the user enters a bookmark. As of now you must physically refresh the page to see the results. Here's my code:

Remember Form Values
I have a form, and I'm using PHP to make sure the users filled in certain fields. If they haven't filled in a field, they are brought back to the form after submitting (using header location) and asked to fill it in. However, when they go back, the form values are all gone.

How can I keep the form values there? I know i've seen it done, but I can't remember where.

Form Values Disappearing
I have a form which users are supposed to enter information into

Naturally there is an extensive error-checking on the form-input.

If an user eg. forgets to enter information into a field an errorpage will be included with the information. Normally it would be possible to press the back-button of the browser to return to the form holding the values of which it was submitted.

Retaining Form Values
I have the form values set to value="<? php echo $Name ?>".

I need to allow a person to access a presentation from within this test form if for example they are unsure of an answer they can return back to the presentation.

I need to retain what they have answered on the form b4 they choose to go out to presentation when they come back. If they only use the back button, values are retained but if they reselect to take the test, I loose all.

I need to save values off when they select link back. Can anyone give me an easy way. I guess I could write to D.B. file with save values and read back in but is there a simpler way?

Saving Form Values
I want to fill in a form in php and for some fields i would like to go to another php page within the same frame. There i can lookup a key to place into a formfield in the previous php page. Well when i return with the lookupped value all the values already entered in this page are missing. So i was trying to save this values temporary within $_SESSION vars. I filled this with a javascript (with an onblur-function) but i am unable to manipulate the $_SESSION vars within javascript. Because php is serverbased.

Remembery Form Values!
I have seen a lot of posts around here lately on how to remember form values after the user hits "submit" [so that they can be corrected]. Well the method that I use is very simple: I store my form in a function, and then when I need to display it I just call that function. After a presses submit, I just display the form the submitted values in it. PHP Code:

HTTP Form Values
On one page I have checkboxes being selected and then submited via a form post. The problem is the values and names of the checkboxes change each time the script is ran. So I have to know what they are to call them on the next page. Is there any way to retrieve all the HTTP passed variables in php that where passed without knowing the variable name?

Passing Values From A Form
I want to know how can i pass values from a html page/form(php) to an applet i.e the values obtained from the form is used as parameters in the applet.

Retaining Form Values
How to retain the values in form tag ,in case user enter wrong
information.

Refill Form Values
How do other sites make it so that when you fill out a form and you mess something up (e.g. the password / verify password are not the same), the values are still in the input box?

I could throw out a bunch of sites that do this... even registering for this forum, web.com, and almost every other place. For a while firefox would autosave it on my site so that when you click back it is waiting for you, but i put in this javascript / php text replacement thing that interferes with that because it generates an image every time the page is loaded so it is not all in the cache or something like that...

Transfering Values From One Form To Another
I have two html pages the first one has email, and name input s. the second page should have amoung other things these two info.

I want to display this name and email into the apropriate inputs of the second page while it is being loaded

I already assigned those values to variables in php file but my concern is mainly how to use them.

Getting Form Values Without Using $_POST
I just started supporting my first php app, and am attempting to set up a development copy locally on my pc. In some places in the application, forms are submitted and the values retrieved w/o the use of $_POST['inputname'] (the form method is post.)

This works on the production site, but not locally. I've made sure the php.ini is the same, and I can't find any other hints as to why this might be. Using PHP5 w/ Apache 2.

I don't want to have to modify a bunch of working code I'm not yet familiar with to get it to work on my pc, thought maybe this would be a no-brainer for the experts. Sample code below. Code:

Stopping <a> From Loading New Page But Still Performing Onclick Action
I want to use hyperlinks to 'load' content by changing the display of
div tags. the problem i have is that unless i specify a href the anchor
does not change the mouse pointer on hover even if display is set to
block. it only look changes when there is a href there. but if i have a
href there then when i click it will load the page, which i dont want.

how can i get the anchor to look like a proper link where the users
pointer changes on hover (in firefox) but a page does not get refreshed
onclick only the onclick function gets loaded.

Multiple Values In A Form - Array
So the problem is:

I have a form wich passes some values to a new page, the problem is the filed name is ever the same but the values changes. But the value passed is always the last one. PHP Code:

Declaring Array In A Form And Getting Its Values
I have this form and I want to store some of the values in arrays. I want a 2 dimensional array. If not possible, 1 will be okay. e.g. $myarray[][];

I want to now use a form and store values in it.
Item 1.1: <INPUT TYPE="TEXT" NAME="myarray[0][0]" VALUE" ">
Item 1.2: <INPUT TYPE="TEXT" NAME="myarray[0][1]" VALUE" ">

Item 2.1: <INPUT TYPE="TEXT" NAME="myarray[1][0]" VALUE" ">
Item 2.2: <INPUT TYPE="TEXT" NAME="myarray[1][1]" VALUE" ">

etc. Is this possible and what is the best way to implement this. The reason I am doing this is because I want to have an SQL statement that goes in a loop manner Code:

Updating Form Values Without Submit
This seems very simple, but I'm not sure how to do it. Lets say that I
have
a form with two select boxes, call them Colours (red, orange, yellow)
and Items (contents depend on colour selected). If the colour is
changed from orange to yellow, I want the second select box to change
it's contents from "Oranges, etc" to "Bananas, etc" without the submit
button being pressed. How do I do this?

Values Not Displaying In Second Form After Post.
I have two forms that are used to collect user information. The first one
takes user inputted values such as fullname, city, address etc. I want these
values to display in the second form when it is called. Both forms are .htm
files that call themselves when the submit button is press via the following
command in each form:

<form method="post" action="<?php $server['PHP_SELF']?>">

The server is set to parse .htm files as php. Everything else is working
fine and all the validation checks are working fine. Based on certain
validation checks that are within the form php code, the user is either left
on the input form page to correct errors or if there are no errors the user
is passed to the next form via a Java call....

<script language="javascript">
<!--
location.replace("order2.htm");
-->
</script>

I have even put a session_write_close() before the redirect hoping this
would fix the problem of not displaying the inputted values from the first
form into the second form.

The server value for global variables is set to ON.

In the second form I have tried to display the values from the first form
after the POST using the following three methods:

$fullname;
echo $HTTP_POST_VARS['fullname'];
echo $_POST['fullname'];

Nothing works...

Values From Form Via Associative Array
I have a form which has a text field and a select box. There are many other fields also in the form . I need get the value of the text field or the select box, depending on which one has a value. Additionally it has to give the value only from the text field even if there is a selection made from the select box. I know that i can get post values from form like this: PHP Code:

Use A Button To Reset Form Values
How can I reset the initial form variables that are set with session
statements when clicking on a button?

I tried this but the function was not called:
<?PHP
function reset_form($none) { $_SESSION = array(); }
?>

<form enctype="multipart/form-data" name="company_info" method="post"
action="add_pic.php">

<input type="text" name="co_name" value ="<?PHP echo $_SESSION['co_name'];
?>" >

<input type="reset" value="Reset" onClick ="<?PHP reset_form();?>">

</form>

Send PHP Values By Web Form Mail
Is that possible to send out the php values by web form?

for example:
<?php echo $x_price;?>

<?php
if ($x_departure!= NULL) {
$sqlwrk = "SELECT * FROM `departure`";
$sqlwrk .= " WHERE `departureID` = " . $x_departure;
$rswrk = mysql_query($sqlwrk);
if ($rswrk && $rowwrk = mysql_fetch_array($rswrk)) {
echo $rowwrk["departurePort"];
}
@mysql_free_result($rswrk);
}
?>

Retrieving The Multiple Values Set By A Form
I am passing a form to a php script for further processing.

I am able to retrieve the last value set for that given form variable
using
$variable=$_REQUEST['form_variable'];

My question is, what is the Php way of retrieving all the values passed
for the same form variable?

For example, if the php script is called with a syntax like

http://xxxx/get_variables.php?form_...riable=variable

, how do I iterate through all the values that form_variable has been
set to?

Form Obtaining Values For Process
I have a form which has a while loop inside to echo a table. But not only that i have a submit button and a check box which I want to have the value of the row's ID so that if the submit button is pressed it will delete the adjacent row.. but just curious if this following idea is going to work : Code:

Validation Using Multiple Values In Value Form Tag
I'm creating a form that will create fixtures for a school games system with php and mysql. I have 3 drop down menus on a form Pupil1, Pupil2 and Game. The form displays data from the mysql database such as Name, House and class in a drop down menu which links to a process form.

This is a extract from the drop down menu, (row0 is the students id number, row2 is the students house)

echo"<option style='background: yellow' value='$row[0] $row[4]'>Name: $row[1] $row[2] | Class: $row[3] | House: $row[4]</option>";

On the process form I would like to validate that people from the green house can only play people from the yellow house which is the $row[4] in the value section but I don't know how to separate the id which is row0 and the house (row4) in the value tag. I can't find any contains tag such as if 'select1' contatains 'yellow'{do this},

Dynamic Form - How To Set Values Of A List
I have a form with a list/menu in it that is populated with records from a database. The items in list#2 are based upon what is selected in list#1.

I have been able to use a combination of php and javascript to get it to work, but the javascript reloads the page to get list #2 to refresh - and that clears out any other fields that have been filled in. Instead of javascript being called for the 'onchange' event for list #1, I'd rather it call php when list#1 is changed and so reset the values in list#2.

OPTIONS:
1. I thought I could have a php function that is called (i.e.   onchange="<?php reload();?>" but I can't figure out how to set the values of the list from within the php function. How to reference form objects with php?

Storing Form Values For Questionnaire
I have been able to output the questions from the database but do not know how to implement the part which requires me to make another php file that retrieves each answer from the radio button and stores them in a databse for a unique user.

Im not sure where the userid of the person doing the questionnaire will be retrieved a as have not yet coded this. But my system needs to know whose doing the questionnaire and what asnwers they have seletced. Code:

Updating Multiple Form Values To MySQL
i am building a content management system for my employer's Web site, which is a daily newspaper. haven't had too much trouble learning PHP up to this point, but I have a problem now that I am finding difficult to figure out. any help would be much appreciated.

I have two MySQL tables for a Poll on our site, one named PollQuestions and one named PollAnswers. I am trying to build an administration form that will allow the user to pull up both the question and answers for any given poll and edit them if they need to. I haven't had a problem with the Poll Question, but with the Poll Answers, I am unsure how I can pull each Poll Answer into a text field and update all of them in one query based on an ID field for the answers.

In other words, I have each answer pulling into the form from the database and for each answer, i have a hidden field that stores that particular answer's ID number.

So how do I update all of the answers in one query based on that particular answer's ID number? I have written the following code, but it does not work. Any help would be much appreciated.

For the form itself, here is the code for the Answer text fields:

How PHP $_POST Gets The Multiple Values From A HTML Form?
I am try test a simple HTML form with PHP

<form method=POST action="testing.php">
Cat <input type="checkbox" name="pet" value="cat">
Dog <input type="checkbox" name="pet" value="dog">
Pig <input type="checkbox" name="pet" value="pig">
<br>
<select name="dates" multiple>
<option value="Monday">Monday</option>
<option value="Tuesday">Tuesday</option>
<option value="Wednesday">Wednesday</option>
<option value="Thursday">Thursday</option>
<option value="Friday">Friday</option>
<option value="Saturday">Saturday</option>
<option value="Sunday">Sunday</option>
</select><br>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>

When I checked cat, pig and selected Tuesday and Saturday from the form
and click submitt

My testing.php is

<?php
$pet = $_POST['pet'];
$dates = $_POST['dates'];
print_r($pet);
var_dump($dates);
?>

The $_POST['pet'] and $_POST['dates']
are NOT return as array nor multiple
strings seperated with a comma.
It only return the LAST string I have
checked and/or selected.

How do I get the multiple values from the
checkbox and the multiple select from a
HTML form in PHP?

Textarea Problem In Form: Values Not Recognised
In a php form that should be send by email, I have been puzzling the whole
night long about the fact that the content of a textarea was not passed
through the email message. Curiously enought it worked when I omitted the
standard text in the text area, so
<textarea name = "reaction">Please give your reaction here</textarea>
the value $reaction in my mailform script remained empty.
<textarea name = "reaction"></textarea>
however, worked properly.
I detected this by coincidence because I had written almost a similar script
for another site but without default values in the text area. I couldn't
find any explanation for this behaviour on the web.


Passing Values Using Drop Down Menu To Same Form.
how I am able to do this without the use of a "submit" button - ie onchange. Here is what I am working with.

<form name="form1" method="post" action="">
<select name="MyNumber">
<option value="One">One</option>
<option value="Two">Two</option>
<option value="Three">Three</option>
<option value="Four">Four</option>
<option value="Five">Five</option>
</select>
<input type="submit" name="Submit" value="Submit">
</form>

<?php @print ($MyNumber);?>

Problem On IE Refreshing Form Elements Values
I have this problem I canīt solve.

Iīm using some mix of javascript / php / ajax code to open a text
file, process its info and close it.

While skiping through the text file lines, Iīd like some of myForm
elements be updated with the info extracted from the file.

This way, the user realice that actually some process is being executed
and forgets about "oh ! this isnīt working, I'll try closing and
opening the app again".

Here is some part of the HTML code:

<FORM name="myForm" id="myForm" method="POST" >

<INPUT type="text" name="employee" id="employee">

<INPUT type="button" name="btnProcess" id="btnProcess"
onclick="xajax_ProcessFile();" >

</FORM>

and part of my ProcessFile() php function should look like:

$h = fopen($file_name,"rb") ;

while( ($fld = fgetcsv($h, 35," ")) !== FALSE ) {
$emp = $fld[0] ;

$objResponse->addScript("document.getElementById('employee').value='$emp'");
}
fclose($h);
return $objResponse->getXML();

Updating A Slew Of Values Into MySQL From A Form
I'm working on a script to edit stored values which I will call on to change the appearence of certain parts of my website. I figured that I can store default values in MySQL, echo those values into a form, then edit whichever values I want, and have it updated in MySQL. However, I can't get the updating into MySQL part to work.

The form displays everything the way it should, including the current values in the database. When I try updating it, instead of using the new value, it instead inserts blank space. I *think* it's because of my query, but I don't see why it shouldn't work, since I did define $values = $_POST['values'] at the top of the script. I don't know if it's my logic that's off, or my code, but I would appreciate any assistance. PHP Code:

Blank Form Not Producing NULL Values
I have the following PHP script which is a data entry form for a MySQL database: PHP Code:

Retrieve Array From FORM List Of Values?
I have created a form where a user selects 2 items from a list of 8 values.
That form field is called "choices" and returns a value to the php file as
$choices. This form posed no problem when I only allowed a single item to be
selected, but the client now needs to have 2 items selected at a time.

The problem I'm having is that I don't know how to turn the multiple
selections on the form in to an array. I thought the $choices variable
would automatically become an array, but
Using[color=blue]
> for ( $i = 0; $i<2; $i++ )
> echo "$choices[$i] ";[/color]
only returns the first two letters of the last selected item value.

And
[color=blue]
> foreach($choices as $articles)
> echo $articles. ' ' ;[/color]

Returns an invalid argument.

While echo $choices returns the second item selected in the list, but not
the first.
It appears that the variable is replacing the first item selected with the
second rather than returning an array.


Copyright Đ 2005-08 www.BigResource.com, All rights reserved