473,378 Members | 1,688 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

passing variables to new window in php

1.

i have a self submitting form using POST
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST" id="test2" name="registrationform">

i am not using any javascript assuming javascript is turned off in a users browser.

i have a feature where in a user can click on an image to find out if a username is available or not. using javascript i am able to capture the value entered, pass the value entered by the user and open a new window and display a message with a php file if the username is available or not

however since i am not using javascript i used the following code to call the same php file which checks for the user name,

<a href="checkusername.php?usernameis="<?php echo($username); ?> target="_blank"> <img src="image.jpg"> </a>

however i am not able to pass the value of the username entered in the textfield by the user.

code in checkusername.php is

$username = $_GET["usernameis"]; and the remaining code to connect to database and display a message.

how can i pass the value entered in the textfield to checkusername.php when the image is clicked.

textfield is defined as follows = <input name="username" type="text" value="<?php echo($username) ; ?>" />


2.
i need to validate a password which can consist of both letters and numbers and should be between 5 to 10 characters only.

how can i rewrite the following preg_match to specify the condition of 5 to 10 characters only as presently it is not working

as i seem to be missing something in the syntax.

if($password == "" || !preg_match('/^[a-zA-Z0-9]{\(5)$|^\(10)}+$/', $password) )

please advice.

thanks.
Mar 10 '08 #1
2 1248
zorgi
431 Expert 256MB
For No1

Try changing:

[HTML]<a href="checkusername.php?usernameis="<?php echo($username); ?> target="_blank"> [/HTML]


into


[HTML]<a href="checkusername.php?usernameis=<?php echo($username); ?>" target="_blank">[/HTML]
Mar 10 '08 #2
Markus
6,050 Expert 4TB
No1
Why dont you use a form with an image as the submit button?
[html]
<form name="someForm" action="somephppage.php" method="post">
<input type="text" name="username" />
<input type="image" src="locationOfImage.jpg" height=".." width=".." name="submit" />
</form>
[/html]

No2
Try:
[php]
if($password == "" || !preg_match('/^[a-zA-Z0-9]{5,10}+$/', $password) )
[/php]
Mar 10 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Consuelo Guenther | last post by:
Hello, I am having problems with passing variables between pages. I have the following: First asp page has the function: -----------------------------------------------------------------------...
5
by: Andy Fish | last post by:
Hi, I have a HTML page with javascript in it which pops up another HTML page. I can pass simple variables fairly freely between the two pages. I can pass objects between them two, and I have...
5
by: Jim Banks | last post by:
Greetings I'm opening a pop up window with a html form, (in one document) and I want to pass a variable to the html form called from the hyperlink. Here's the code I'm using to pop up the...
12
by: Mal Ice | last post by:
I am creating an initial index.htm page on which I show some disclaimers and introduction information. In the head section I have Javascript which determines the screen resolution of the client....
6
by: veganeater | last post by:
Hi Everyone, I was wondering if there was a way to pass a variable to a popup window. The purpose is make it so when a user clicks on a specific region/link of the glossary page, a popup opens...
2
by: Les Peabody | last post by:
Hello. I'm a rookie ASP VBScripter and am having a difficult time scripting the following scenario: I have an index.asp file that has a multi-line text box and a button of type button. When...
5
by: Steve | last post by:
Hi, I currently have a problem passing a variable value from one page to another. Once a form submit button is pressed java pops up a window and displays some information. The problem being is...
1
by: johnjsforum | last post by:
Buddies, I have a web page to create HTML buttons dynamically as in the “formDivColorPicker” function ////////////////////////////////////////////////////////////////////////////////////...
2
by: Fromethius | last post by:
Without creating global variables, is there a way to pass variables to the WindowProcedure that handles the messages? For example, if I create a variable and initialize it in WinMain, is there any...
0
by: Adrienne Boswell | last post by:
Gazing into my crystal ball I observed doctor@doctor.nl2k.ab.ca (The Doctor) writing in news:ge58o7$9em$1@gallifrey.nk.ca: <snip> Please understand that 1. For users with javascript...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.