What would be the exact CodeIGniter format to the below form tag. Thanks
<form action="links/link1.php?view=one" method="post">
Will this work
echo form_open('links/link1.php?view=one');
That's right.
echo form_open('links/link1.php?view=one');
will create a form similar to this:
<form action="links/link1.php?view=one" method="post">
Hope this helps.
Related
I would like to add the ID of a User to the form action as a URL.
For Example view_member.php?id=2
Can somebody possible show me the correct way to format PHP code in the form action below where I can include the id as $recptid
$recptid = $_GET['id'];
I have tried
<form action="<?phpview_member.php?id=$recptid?>" method="post">
I would like to be able to add a link but my formatting is wrong
// insert php code as URL in the form action the a submit is pressed
<form action="<?php?>" method="post">
</form>
Thanks in advance for any help
try this,
<form action="<?php echo "view_member.php?id=".$recptid; ?>" method="post">
i hope it will be helpful.
I have a page which is accessible via a url - something like this http://websitename/index.php?q=pagename. On this page, I have a form that I would like to submit to the same page so that I could do some post processing. I have tried the following things but couldn't get it to work -
<form name="formname" action="pagename.php" method="post">
<form name="formname" action="" method="post">
<form name="formname" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
In other words, I would like to submit the form to pagename.php file (where the form resides). The page (pagename.php) is not directly accessible. How do I get this done? I will greatly appreciate any help on this one. Thanks.
Try this:
In HTML5 you can just do <form> and its set to self.
<form action=<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?> method="post">
OR
<form name="formname" id="mainForm" method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['REQUEST_URI'];?>">
OR
<form method="POST" action="<?=($_SERVER['PHP_SELF'])?>">
The point is your $_SERVER variable contains all the information you would require to generate that specific page's URL. If you have decided not to go with the HTML5 way, then one of these options should work. Otherwise you're missing something else not mentioned in your question.
i think this will solve your problem
<form name="formname" action="#" method="post">
Try
<form method="post">/*your stuff here*/</form>
and you should add a submit button with attribute "name=submit" so the form could be submitted also track if its have been posted with php then do your actions like below
if(isset($_POST["submit"])){ /* your code */}
I am working with PHP forms.
The opening form tag looks like this:
<form name="adv_search_form" action="<?php echo $targetpage; ?>" method="GET">
This generated the following HTML:
<form name="adv_search_form" action="index.php?&rel=common_listing&module=company&sort_option=&search_option=&show_max_row=15" method="GET">
When I submit this form, I land on a URL:
http://localhost/projectcode12may2014/ampanel/index.php?field%5B%5D=broker_name&adv_operation%5B%5D=LIKE&value%5B%5D=&query_type%5B%5D=AND&submit=Submit
But what I want is that
?field%5B%5D=broker_name&adv_operation%5B%5D=LIKE&value%5B%5D=&query_type%5B%5D=AND&submit=Submit
should be appended to the action URL on the landing page. Can anyone suggest any good method for doing this?
Thanks in advance.
If you are using method="get" the parameters in action are overwritten. Only what is in the from will be transmitted.
You need to add hidden fields for all these values. For example:
<input type="hidden" name="module" value="company" />
That is your from data.
You have method="get" in your form tag. This means that the form data is concatinated to the URL. Use method="post" to have send form data as a POST request and keep your URI clean.
So change this line
<form name="adv_search_form" action="<?php echo $targetpage; ?>" method="GET">
to this
<form name="adv_search_form" action="<?php echo $targetpage; ?>" method="post">
Then you can access your form data in PHP with the global $_POST var which holds an array with the submitted data.
This is a normal behavior. Using GET method discard all parameters specified directly in action attribute.
Use POST method instead or move parameters from action attribute of the form to input fields with type="hidden".
I want to post the careers form directly on email using HTML5. To post the form directly on my email id and i used syntax
<form action:"mailto:web#domain.com" method="post" enc type="text/plain">
</form>
but it does not work properly. Please tell me how i links form directly with email id.
Try using
<form action="mailto:web#domain.com" method="post" enctype="text/plain">
instead of
<form action:"mailto:web#domain.com" method="post" enc type="text/plain">
:-)
like below:
<form action="mailto:myforms#mydomain.com" enctype="text/plain" onsubmit="location.href='thanks.html';" >
Refer: http://www.html-form-guide.com/email-form/email-form-mailto.html
Try
<form action="mailto:web#domain.com" method="post" enctype="text/plain">
</form>
You just wrote enctype wrong. Hope this helps :)
I have a form in one of my pages and I want to make it submit to the same page. I am doing this:
<form method="POST" action=".">
But when I submit the form it submits to the root directory of my site instead of to the same page the form is on.
I know that the form is being submitted because I tried temporarily changing the method to GET and when I submitted the form, the URL showed the get variables.
Why is the form not submitting to the current page?
If it's relevant, I'm using PHP with xampp.
Try this:
<form method="POST" action="">
This is what I do
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
I'm a newbie though so if Juampi's answer works too , I'd go with it.