Jump to content

Pass Data On Form Post Without Having It Displayed In Html Source..?


cyfer65

Recommended Posts

Is there anyway to pass a variable/data on a form post without having it displayed in html source..?Like insert the value of an input right as the post occurs...So if $DATA = ABC123and you have a form input like:<input type="submit" id="1" name="AAA" value="XXX"/>Would there be anyway to tack on the $DATA = ABC123 to the end of the input value "XXX" when the form is submitted like "XXX-ABC123" ..?

Link to comment
Share on other sites

mysql_query won't show in your page view. That means store your data in a mysql table. That's the limit of my current knowledge.

Link to comment
Share on other sites

would there be anyway for when the form is submitted to intercept/check the submitted value against an already set variable, then replace the existing input value with that variable like: $VALUE[XXX] = "ABC123";and you have a form input like:<input type="submit" value="XXX"/>so when its submitted the "XXX" value gets replaced with "ABC123"

Link to comment
Share on other sites

Sure. Put some code together and I'll help you with it tomorrow. It's after midnight and time to suspend operations.

Link to comment
Share on other sites

POST data is not sent to the next page in a way that it can be viewed in the page source because it's sent as the $_POST array that I access with php (I'm sure there are probably other ways to do that). That's the way I manipulate the $_POST array. If you can, send at least the start of the script that's the target of the action attribute of your form. What kind of form will it be? html or something else?

Link to comment
Share on other sites

im not sure if your understanding what im wanting to do..? I have a form like this $AAA = "111"$BBB = "222"<form method="post"><input type="submit" name="AAA" value="AAA"/><br><input type="submit" name="BBB" value="BBB"/></form>What I'm wanting to do is, when one of the input buttons are pressed/submitted its value is replaced by a variable that is already set that corresponds the existing input value or name.So during the form submission before the page refreshes passing on the $_POST array, the input value of "AAA" needs to be switched out to "111" in the $_POST array..Is that possible at all..?

Link to comment
Share on other sites

With just php you'd send the output from your form to the action target (a php file) and the php file would do its thing and refresh your entire page with the transformed data. javascript with php would do a similar thing except javascript would only refresh part of your page http://www.w3schools..._livesearch.asp

Link to comment
Share on other sites

everything is occurring on one index.php file..when first visited the index.php echos out the html code and form.when the form is submitted the target is itself index.php - so the page just refreshes passing the $_POST array back to itself where there is php code to interpret the $_POST array and perform other functions accordingly.. But i need to switch out the input value of "AAA" to "111" in the $_POST array before it is read on the submit/refresh

Link to comment
Share on other sites

I suppose you could do it that way with a if statement that checks for whether a key is defined in your $_POST array. So, put that if statement in your php. If it's not there already how would you start it?

Link to comment
Share on other sites

Is there a reason it has to be changed before being submitted, as opposed to niche idea of just validating the value on the server side, so it's it AAA, then just treat as if it was 111.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...