FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP : passing a variable along url
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
PHP : passing a variable along url [message #179050] Fri, 07 September 2012 11:12 Go to next message
pritam chavla is currently offline  pritam chavla
Messages: 1
Registered: September 2012
Karma: 0
Junior Member
Hi group i am having a problem now, actually i am trying to submit a form

and want to pass a parameter along url like
this is my form that is on url(http://localhost/userregistration.php)
<form action = "userhandler.php" method = "POST" id = "validate_form" enctype="multipart/form-data" >

<dl>
<dt><label for="user_name">User Name<span class="req" style="color:red;">*</span></label></dt>
<dd><input type="text" name="user_name" id="user_name" class = "required" size="32" maxlength="128" /></dd>
</dl>

<dl>
<dt><label for="password">Password:<span class="req" style="color:red;">*</span></label></dt>
<dd><input type="password" name="password" id="password" class = "required" size="32" maxlength="32" /></dd>
</dl>


</form>

this is form is submitting on userhandler.php where i am planning to take another parameter org_name
so far i am passing the org_name on
http://localhost/userregistration.php?org_name=blah


but unfortunately when i am trying to get the parameter on userhandler.php file

it is showing me error i.e

Undefined index: org_name in /opt/lampp/htdocs/UI/user/userhandler.php on line 16



Please help me what i am doing wrong
Re: PHP : passing a variable along url [message #179051 is a reply to message #179050] Fri, 07 September 2012 11:16 Go to previous messageGo to next message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma: 0
Senior Member
On Friday, September 7, 2012 12:12:36 PM UTC+1, pritam chavla wrote:
> Undefined index: org_name in /opt/lampp/htdocs/UI/user/userhandler.php on line 16
> Please help me what i am doing wrong

I would help you but my crystal ball is playing up and it is only showing me up to line 15!
Re: PHP : passing a variable along url [message #179052 is a reply to message #179050] Fri, 07 September 2012 11:49 Go to previous messageGo to next message
Shake is currently offline  Shake
Messages: 40
Registered: May 2012
Karma: 0
Member
Something like this?

<form action="userhandler.php?org_name=<?=$_GET['org_name']?>">

Greetings
Re: PHP : passing a variable along url [message #179053 is a reply to message #179050] Fri, 07 September 2012 12:06 Go to previous messageGo to next message
Olaf S. is currently offline  Olaf S.
Messages: 10
Registered: December 2011
Karma: 0
Junior Member
Am 07.09.2012 13:12, schrieb pritam chavla:
> Hi group i am having a problem now, actually i am trying to submit a form
>
> and want to pass a parameter along url like
> this is my form that is on url(http://localhost/userregistration.php)

> <form action = "userhandler.php" method = "POST" id = "validate_form" enctype="multipart/form-data" >
>
> <dl>
> <dt><label for="user_name">User Name<span class="req" style="color:red;">*</span></label></dt>
> <dd><input type="text" name="user_name" id="user_name" class = "required" size="32" maxlength="128" /></dd>
> </dl>
>
> <dl>
> <dt><label for="password">Password:<span class="req" style="color:red;">*</span></label></dt>
> <dd><input type="password" name="password" id="password" class = "required" size="32" maxlength="32" /></dd>
> </dl>
Add this line:
<input type="hidden" name="org-name" value="blah">


>
>
> </form>
>
Re: PHP : passing a variable along url [message #179076 is a reply to message #179050] Tue, 11 September 2012 12:51 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 3
Registered: September 2012
Karma: 0
Junior Member
On userhandler.php define the variable org_name
if($_GET['org_name']!='')
{
$org_name = $_GET['org_name'];
}
else
{
$org_name = '';
}
Re: PHP : passing a variable along url [message #179079 is a reply to message #179076] Tue, 11 September 2012 13:34 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 9/11/2012 8:51 AM, vivek wrote:
> On userhandler.php define the variable org_name
> if($_GET['org_name']!='')
> {
> $org_name = $_GET['org_name'];
> }
> else
> {
> $org_name = '';
> }
>
>

Which will give an E_NOTICE if $_GET['org_name'] is not set.

You should always use isset() to ensure a parameter is set before trying
to use it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Please help In if else while using array
Next Topic: average rate
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 02:34:04 GMT 2024

Total time taken to generate the page: 0.02499 seconds